Skip to content

Commit 2758ffd

Browse files
Google Drive Improvements (#3057)
* Google Drive Improvements * mypy * should work! * variable cleanup * final fixes
1 parent 07a1b49 commit 2758ffd

File tree

22 files changed

+802
-525
lines changed

22 files changed

+802
-525
lines changed

backend/danswer/connectors/gmail/connector.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,16 @@ def _fetch_threads(
277277
fields=THREAD_LIST_FIELDS,
278278
q=query,
279279
):
280-
full_thread = add_retries(
281-
lambda: gmail_service.users()
282-
.threads()
283-
.get(
284-
userId=user_email,
285-
id=thread["id"],
286-
fields=THREAD_FIELDS,
287-
)
288-
.execute()
289-
)()
280+
full_threads = execute_paginated_retrieval(
281+
retrieval_function=gmail_service.users().threads().get,
282+
list_key=None,
283+
userId=user_email,
284+
fields=THREAD_FIELDS,
285+
id=thread["id"],
286+
)
287+
# full_threads is an iterator containing a single thread
288+
# so we need to convert it to a list and grab the first element
289+
full_thread = list(full_threads)[0]
290290
doc = thread_to_document(full_thread)
291291
if doc is None:
292292
continue

0 commit comments

Comments
 (0)