Skip to content

fix(tasks): survive external CancelledError during connection reset - #10508

Open
Willfric wants to merge 1 commit into
Rapptz:masterfrom
Willfric:fix/task-loop-connection-reset
Open

Willfric wants to merge 1 commit into
Rapptz:masterfrom
Willfric:fix/task-loop-connection-reset

Conversation

@Willfric

@Willfric Willfric commented Aug 31, 2026 •

Copy link
Copy Markdown

Summary

fixes #9074

tasks die after a connection reset, been broken for 3 years mate. basically when the websocket resets it cancels the task externally, that CancelledError was hitting the outer handler and just killing the loop dead. reconnect logic never even got a chance to run innit

shoved an inner CancelledError handler in the try block around coro(). if its an external cancel it backs off and retries, if the user actually asked for a stop it raises like normal

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@Soheab

Soheab commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

What's the reason you didn't use the PR template?

@Willfric

Copy link
Copy Markdown
Author

What's the reason you didn't use the PR template?

my bad, updated it

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tasks stop looping following a connection reset

2 participants