Repository navigation
fix(proxy): cancel periodic TOIN task on shutdown - #2906
chopratejas merged 1 commit into
Conversation
PR governanceThis PR does not yet satisfy the required template fields:
Please update the PR body, or move the PR back to draft while it is still in progress. |
JerrettDavis
left a comment
There was a problem hiding this comment.
The periodic task is now owned by the application lifespan, initialized safely before startup, cancelled and awaited through the existing bounded shutdown helper, and cleared after cleanup. The TestClient lifecycle regression verifies that the task is live during service operation and cancelled at exit. Broader CI has not run on this fork.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
chopratejas
left a comment
There was a problem hiding this comment.
Maintainer review complete: the periodic task is owned by application state, cancelled and awaited through bounded shutdown, then cleared. The lifespan regression verifies the real startup and shutdown contract. Merge after full CI.
Description
Retains the periodic TOIN statistics task on application state and reaps it during proxy lifespan shutdown.
Fixes #2896
Type of Change
Changes Made
app.state.periodic_toin_stats_taskwhen enabled.Testing
pytest)ruff check .)mypy headroom)Test Output
Real Behavior Proof
TestClientlifespan; only the unavailable nativeheadroom._coreimport was replaced with an in-process test stub.TestClientcontext, and checked that the task was canceled and the state reference cleared.headroom._coreextension.Review Readiness
Checklist
CHANGELOG.md- it is generated by release-please from my Conventional Commit PR title.Screenshots (if applicable)
Not applicable.
Additional Notes
The shutdown uses the existing three-second
_timed()bound and handles the disabled configuration without creating a task.