mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-22 00:31:44 +00:00
cleanup_old_spend_logs only caught Exception, so a run cut short by CancelledError recorded no outcome and logged nothing. Under uvicorn the job was never cancelled at all: uvicorn re-raises the captured SIGTERM as soon as the lifespan shutdown returns, before asyncio cancels outstanding tasks, so an in-flight scheduler job simply died with the process. The cleanup now handles CancelledError by logging elapsed time, rows deleted and batch count at error level, recording outcome="aborted", and re-raising. The lifespan shutdown stops the scheduler and awaits the jobs it cancels while the database is still connected, so that handler runs under uvicorn too, and the pod lock is released instead of orphaned. Resolves LIT-6990 |
||
|---|---|---|
| .. | ||
| test_graceful_shutdown_manager.py | ||
| test_scheduled_jobs.py | ||