Spaces:
Sleeping
Sleeping
Claude Code Claude Opus 4.6 commited on
Commit ·
a878b29
1
Parent(s): bd0f4c9
fix: Handle asyncio.CancelledError
Browse filesCo-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -2698,8 +2698,9 @@ except Exception as e:
|
|
| 2698 |
f"Base directory: {BASE_DIR}"
|
| 2699 |
)
|
| 2700 |
except asyncio.CancelledError:
|
| 2701 |
-
logger.
|
| 2702 |
-
|
|
|
|
| 2703 |
|
| 2704 |
@fallback_app.get("/api/health")
|
| 2705 |
async def error_health():
|
|
@@ -2711,8 +2712,9 @@ except Exception as e:
|
|
| 2711 |
"error_log": str(ERROR_LOG_FILE)
|
| 2712 |
}
|
| 2713 |
except asyncio.CancelledError:
|
| 2714 |
-
logger.
|
| 2715 |
-
|
|
|
|
| 2716 |
|
| 2717 |
# Add shutdown handler to fallback app too
|
| 2718 |
@fallback_app.on_event("shutdown")
|
|
|
|
| 2698 |
f"Base directory: {BASE_DIR}"
|
| 2699 |
)
|
| 2700 |
except asyncio.CancelledError:
|
| 2701 |
+
logger.debug("[API_CANCEL] Error fallback / was cancelled")
|
| 2702 |
+
from fastapi.responses import Response
|
| 2703 |
+
return Response(status_code=204, content=None)
|
| 2704 |
|
| 2705 |
@fallback_app.get("/api/health")
|
| 2706 |
async def error_health():
|
|
|
|
| 2712 |
"error_log": str(ERROR_LOG_FILE)
|
| 2713 |
}
|
| 2714 |
except asyncio.CancelledError:
|
| 2715 |
+
logger.debug("[API_CANCEL] Error fallback /api/health was cancelled")
|
| 2716 |
+
from fastapi.responses import Response
|
| 2717 |
+
return Response(status_code=204, content=None)
|
| 2718 |
|
| 2719 |
# Add shutdown handler to fallback app too
|
| 2720 |
@fallback_app.on_event("shutdown")
|