feat: update Google indexing functions to track skipped messages

- Modified the indexing functions for Google Calendar and Gmail to return the count of skipped messages alongside indexed messages, enhancing performance tracking.
- Updated related tests to accommodate the new return values, ensuring comprehensive coverage of the indexing process.
- Improved error handling to maintain consistency in returned values across different indexing functions.
This commit is contained in:
Anish Sarkar 2026-03-19 20:56:40 +05:30
parent 80f7d5f34a
commit 8e7cda31c5
5 changed files with 28 additions and 33 deletions

View file

@ -2287,10 +2287,9 @@ async def run_google_gmail_indexing(
end_date: str | None,
update_last_indexed: bool,
on_heartbeat_callback=None,
) -> tuple[int, str | None]:
# Use a reasonable default for max_messages
) -> tuple[int, int, str | None]:
max_messages = 1000
indexed_count, error_message = await index_google_gmail_messages(
indexed_count, skipped_count, error_message = await index_google_gmail_messages(
session=session,
connector_id=connector_id,
search_space_id=search_space_id,
@ -2301,8 +2300,7 @@ async def run_google_gmail_indexing(
max_messages=max_messages,
on_heartbeat_callback=on_heartbeat_callback,
)
# index_google_gmail_messages returns (int, str) but we need (int, str | None)
return indexed_count, error_message if error_message else None
return indexed_count, skipped_count, error_message if error_message else None
await _run_indexing_with_notifications(
session=session,