From 0708002953e79078e3b78a57f2eabef591bf201d Mon Sep 17 00:00:00 2001 From: Yuhong Sun Date: Wed, 19 Jul 2023 23:52:48 -0700 Subject: [PATCH] Check for Credential delete before running queued index attempt (#221) --- backend/danswer/background/update.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/backend/danswer/background/update.py b/backend/danswer/background/update.py index fea7cfdef..bc2fd10d0 100755 --- a/backend/danswer/background/update.py +++ b/backend/danswer/background/update.py @@ -93,13 +93,23 @@ def run_indexing_jobs(db_session: Session) -> None: logger.info(f"Found {len(new_indexing_attempts)} new indexing tasks.") for attempt in new_indexing_attempts: if attempt.connector is None: - logger.warning(f"Skipping index task as connector has been deleted: {attempt}") + logger.warning( + f"Skipping index attempt as Connector has been deleted: {attempt}" + ) mark_attempt_failed(attempt, db_session, failure_reason="Connector is null") continue + if attempt.credential is None: + logger.warning( + f"Skipping index attempt as Credential has been deleted: {attempt}" + ) + mark_attempt_failed( + attempt, db_session, failure_reason="Credential is null" + ) + continue logger.info( f"Starting new indexing attempt for connector: '{attempt.connector.name}', " f"with config: '{attempt.connector.connector_specific_config}', and " - f"with credentials: '{[c.credential_id for c in attempt.connector.credentials]}'" + f"with credentials: '{attempt.credential_id}'" ) mark_attempt_in_progress(attempt, db_session)