fix(qqbot): clean up resources after reconnect failure - #41773
fix(qqbot): clean up resources after reconnect failure#41773k176060444-lgtm wants to merge 2 commits into
Conversation
|
Code Review — Clean ✅ Reviewed the diff (2 files, ~160 lines). Findings:
No issues found. LGTM. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the focused reconnect cleanup. The premise remains valid on current main: gateway/platforms/qqbot/adapter.py:468 assigns _session before ws_connect(), while the failure handler at gateway/platforms/qqbot/adapter.py:684-686 only logs and returns. The proposed clear-before-close, independent best-effort cleanup addresses that path.
Problems
tests/gateway/test_qqbot.py:2253calls_reconnect(0)with the production delay still active.gateway/platforms/qqbot/constants.py:41defines the first retry delay as two seconds; the five added tests therefore add about ten seconds of real waiting.
Suggested changes
- Stub
asyncio.sleepor patch the backoff value for this test class.
Automated hermes-sweeper review.
ffb234b to
2fafd49
Compare
Summary
Clean up stale QQBot WebSocket and aiohttp session resources when a reconnect attempt fails.
Context
The closed-WebSocket CPU busy-loop guard has already been merged upstream. This PR keeps the remaining focused resource-cleanup improvement:
Tests
python3 -m pytest tests/gateway/test_qqbot.py -q— 166 passedRelated
This extracts the remaining resource-cleanup improvement from #39430 after the primary busy-loop guard was merged upstream.