mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-04 22:02:16 +02:00
refactor: Improve indexing notification handling and return values
- Enhanced error handling in the indexing process to differentiate between actual failures and cases where no new documents are processed. - Updated notification messages to reflect the status accurately, including a message for when no new items are synced. - Standardized return values across various indexer tasks to return `None` on success, simplifying logging and error management.
This commit is contained in:
parent
18ec9543bd
commit
1ea0475f73
7 changed files with 34 additions and 18 deletions
|
|
@ -549,7 +549,7 @@ async def index_discord_messages(
|
|||
logger.info(
|
||||
f"Discord indexing completed: {documents_indexed} new messages, {documents_skipped} skipped"
|
||||
)
|
||||
return documents_indexed, result_message
|
||||
return documents_indexed, None # Return None on success (result_message is for logging only)
|
||||
|
||||
except SQLAlchemyError as db_error:
|
||||
await session.rollback()
|
||||
|
|
|
|||
|
|
@ -464,7 +464,7 @@ async def index_notion_pages(
|
|||
# Clean up the async client
|
||||
await notion_client.close()
|
||||
|
||||
return total_processed, result_message
|
||||
return total_processed, None # Return None on success (result_message is for logging only)
|
||||
|
||||
except SQLAlchemyError as db_error:
|
||||
await session.rollback()
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ async def index_slack_messages(
|
|||
logger.info(
|
||||
f"Slack indexing completed: {documents_indexed} new channels, {documents_skipped} skipped"
|
||||
)
|
||||
return total_processed, result_message
|
||||
return total_processed, None # Return None on success (result_message is for logging only)
|
||||
|
||||
except SQLAlchemyError as db_error:
|
||||
await session.rollback()
|
||||
|
|
|
|||
|
|
@ -460,7 +460,7 @@ async def index_teams_messages(
|
|||
documents_indexed,
|
||||
documents_skipped,
|
||||
)
|
||||
return total_processed, result_message
|
||||
return total_processed, None # Return None on success (result_message is for logging only)
|
||||
|
||||
except SQLAlchemyError as db_error:
|
||||
await session.rollback()
|
||||
|
|
|
|||
|
|
@ -400,7 +400,7 @@ async def index_crawled_urls(
|
|||
f"{documents_updated} updated, {documents_skipped} skipped, "
|
||||
f"{len(failed_urls)} failed"
|
||||
)
|
||||
return total_processed, result_message
|
||||
return total_processed, None # Return None on success (result_message is for logging only)
|
||||
|
||||
except SQLAlchemyError as db_error:
|
||||
await session.rollback()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue