lohitkolluri commented on code in PR #67900:
URL: https://github.com/apache/airflow/pull/67900#discussion_r3350055154


##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/backfills.py:
##########
@@ -269,6 +284,14 @@ def create_backfill(
             status_code=status.HTTP_400_BAD_REQUEST,
             detail=str(e),
         )
+    except OperationalError as e:
+        if "database is locked" in str(e):
+            raise HTTPException(
+                status_code=status.HTTP_503_SERVICE_UNAVAILABLE,
+                detail="Backfill creation failed because the database is 
locked. "
+                "This is a transient error — please retry the request.",
+            )
+        raise

Review Comment:
   Good catch — the second handler was indeed unreachable. I've consolidated 
both into a single handler with retry logic: 3 attempts with exponential 
backoff (0.1s, 0.2s, 0.4s) before falling through to the HTTP 503. The 
implementation also uses str(e) matching for robustness instead of 
e.orig.args[0]. Pushed in the latest commit.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to