Skip to content

Commit b899534

Browse files
raunakabWeves
authored andcommitted
Remove invocation of parallel_yield (was causing problems)
1 parent 3a9563e commit b899534

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

backend/onyx/connectors/teams/connector.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
from onyx.connectors.models import TextSection
3535
from onyx.file_processing.html_utils import parse_html_page_basic
3636
from onyx.utils.logger import setup_logger
37-
from onyx.utils.threadpool_concurrency import parallel_yield
3837
from onyx.utils.threadpool_concurrency import run_with_timeout
3938

4039
logger = setup_logger()
@@ -194,7 +193,8 @@ def load_from_checkpoint(
194193
team=team,
195194
)
196195

197-
docs = [
196+
# An iterator of channels, in which each channel is an iterator of docs.
197+
channels_docs = [
198198
_collect_documents_for_channel(
199199
graph_client=self.graph_client,
200200
team=team,
@@ -205,12 +205,13 @@ def load_from_checkpoint(
205205
for channel in channels
206206
]
207207

208-
for doc in parallel_yield(
209-
gens=docs,
210-
max_workers=self.max_workers,
211-
):
212-
if doc:
213-
yield doc
208+
# Was previously `for doc in parallel_yield(gens=docs, max_workers=self.max_workers): ...`.
209+
# However, that lead to some weird exceptions (potentially due to non-thread-safe behaviour in the Teams library).
210+
# Reverting back to the non-threaded case for now.
211+
for channel_docs in channels_docs:
212+
for channel_doc in channel_docs:
213+
if channel_doc:
214+
yield channel_doc
214215

215216
logger.info(
216217
f"Processed team with id {todo_team_id}; {len(todos)} team(s) left to process"

0 commit comments

Comments
 (0)