New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cancel all long-running tasks #1793
Conversation
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #1793 +/- ##
==========================================
- Coverage 56.09% 55.08% -1.02%
==========================================
Files 48 48
Lines 7328 7329 +1
==========================================
- Hits 4111 4037 -74
- Misses 3217 3292 +75
... and 1 file with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
d9a639d
to
f5c1fcf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
56e3398
to
2c700fd
Compare
in order to properly cleanup all long-running tasks we have to keep a list of them
rename variable for create_task wrap cancel() with try/catch fixup
2c700fd
to
3448114
Compare
another interesting side effect of this is that extensions are loaded inside tests aswell, but I dont think this should be considered an issue |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
great job @jackstar12 !
good catch, dont install default exts for test when run locally! :) |
Not all long-running tasks are cancelled upon shutdown, which caused some issues with
WALLET.cleanup
.I introduced a few new functions:
create_task
basically a wrapper around the asyncio equivalent, adds the task to a listcancel_all_tasks
cancels all tasks previously created withcreate_task
(if any are already stopped,cancel
will do nothing)create_permanent_task
wrapper aroundcreate_task
withcatch_everything_and_restart
Now all tasks are cancelled on shutdown and
WALLET.cleanup
goes without errors.