-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(conductor) use cancellation tokens for shutdown (#845)
## Summary Switches from using oneshot channels to cancellation tokens. ## Background This is much neater than using channels to signal shutdown. One token can be passed to all tasks, instead of creating (and storing) one channel per task. Note that conductor will shut down immediately and not try to drain its queue of pending blocks. Also note that this PR does not address conductor hanging if it receives SIGTERM during startup, where various async initializers might hang (leaving to a followup PR). ## Changes - Replace all `oneshot` channels used for signalling shutdown with `CancellationToken` - Make all `select!` loops biased, favoring cancellation over all other branches - reorder the other `select!` arms, favoring sending existing blocks to executor over pulling new blocks, and heights - Add comments to various unclear code parts - Unify shutdown messages for all long lived tasks. ## Testing This needs to be tested end-to-end. --------- Co-authored-by: noot <36753753+noot@users.noreply.github.com>
- Loading branch information
1 parent
2c0d2b1
commit 8620e83
Showing
8 changed files
with
143 additions
and
122 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.