File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
backend/onyx/connectors/teams Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change 34
34
from onyx .connectors .models import TextSection
35
35
from onyx .file_processing .html_utils import parse_html_page_basic
36
36
from onyx .utils .logger import setup_logger
37
- from onyx .utils .threadpool_concurrency import parallel_yield
38
37
from onyx .utils .threadpool_concurrency import run_with_timeout
39
38
40
39
logger = setup_logger ()
@@ -194,7 +193,8 @@ def load_from_checkpoint(
194
193
team = team ,
195
194
)
196
195
197
- docs = [
196
+ # An iterator of channels, in which each channel is an iterator of docs.
197
+ channels_docs = [
198
198
_collect_documents_for_channel (
199
199
graph_client = self .graph_client ,
200
200
team = team ,
@@ -205,12 +205,13 @@ def load_from_checkpoint(
205
205
for channel in channels
206
206
]
207
207
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
214
215
215
216
logger .info (
216
217
f"Processed team with id { todo_team_id } ; { len (todos )} team(s) left to process"
You can’t perform that action at this time.
0 commit comments