Skip to content
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

use cancellation token for shutdown #32

Merged
merged 1 commit into from
Oct 26, 2024

Conversation

maxcountryman
Copy link
Owner

This refactors worker shutdown to use a cancellation token to signal shutdown. By doing so, we can avoid managing an atomic bool. It also makes it possible to provide addtional methods, such as a shutdown method, on the worker itself to signal shutdown.

This refactors worker shutdown to use a cancellation token to signal
shutdown. By doing so, we can avoid managing an atomic bool. It also
makes it possible to provide addtional methods, such as a `shutdown`
method, on the worker itself to signal shutdown.
@maxcountryman
Copy link
Owner Author

/cc @kirillsalykin I ended up using a cancellation token here instead (Notify could also work, but it's not cancel safe and requires pinning to work as I'd want it).

From here we could add shutdown or similar to the worker. Then the job could wrap that. Likewise with the scheduler I think.

Let me know what you think.

@kirillsalykin
Copy link

LGTM

@maxcountryman maxcountryman merged commit 6127c9a into main Oct 26, 2024
4 checks passed
@maxcountryman maxcountryman deleted the shutdown-cancellation-token branch October 27, 2024 17:23
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.

2 participants