From 498b943833e2d285ea1e74f0534497e8bdfdf3b6 Mon Sep 17 00:00:00 2001 From: star-nox Date: Mon, 16 Dec 2024 16:29:49 -0600 Subject: [PATCH] added condition to catch timed out error --- ai_ta_backend/beam/ingest.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/ai_ta_backend/beam/ingest.py b/ai_ta_backend/beam/ingest.py index 90e38896..374685f8 100644 --- a/ai_ta_backend/beam/ingest.py +++ b/ai_ta_backend/beam/ingest.py @@ -1164,18 +1164,16 @@ def split_and_upload(self, texts: List[str], metadatas: List[Dict[str, Any]], ** collection_name=os.environ['QDRANT_COLLECTION_NAME'], # type: ignore points=vectors, # type: ignore ) - except Timeout as e: - # it's fine if this gets timeout error. it will still post, according to devs: https://github.com/qdrant/qdrant/issues/3654 - print( - "Warning: all update and/or upsert timeouts are fine (completed in background), but errors might not be: ", - e) - pass except Exception as e: - # log other exceptions logging.error("Error in QDRANT upload: ", exc_info=True) err = f"Error in QDRANT upload: {e}" - sentry_sdk.capture_exception(e) - raise Exception(err) + if "timed out" in str(e): + # timed out error is fine, task will continue in background + pass + else: + print(err) + sentry_sdk.capture_exception(e) + raise Exception(err) ### Supabase SQL ### contexts_for_supa = [{