Repository navigation
Fix multi-printer retry CPU loops - #16
Merged
Merged
Conversation
cjavad
force-pushed
the
fix/connection-retry-cpu
branch
from
September 17, 2026 12:07
a5fe975 to
952f0dc
Compare
cjavad
force-pushed
the
fix/connection-retry-cpu
branch
from
September 17, 2026 12:22
952f0dc to
c47680e
Compare
cjavad
marked this pull request as ready for review
September 17, 2026 12:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The multi-printer connection loop can consume a CPU core during shutdown.
asyncio.CancelledErrorwas treated as a reconnectable network error, so cancellation was swallowed. Once the event loop's DNS executor shut down, every reconnect raisedRuntimeError, logged a full traceback, and retried immediately.This change exits and cleans up on cancellation, routes unexpected connection failures through the existing reconnect backoff, and honors
Retry-After: Nsfrom failedadd_connectionresponses. A server response such asRetry-After: 249snow delays the next add attempt for 249 seconds instead of using an unrelated local exponential delay.Validation:
pytest -q tests/test_connection_retry.py tests/test_multi_printer_retry.py tests/test_connection_manager.py(7 passed)test_client_app.py: 84 passed; three environment failures require writes outside the workspace or network-interface access.stracebefore mitigation measured about 72 traceback cycles per second on each wedged worker.