Open
Conversation
83cb650 to
3e39aa8
Compare
Contributor
Author
|
Reworking this to depend on #592, ignore for now |
90c91bf to
3fdda0f
Compare
Contributor
Author
|
Depends on #592 now. |
3fdda0f to
9e7a372
Compare
9e7a372 to
628803c
Compare
e950618 to
508695e
Compare
508695e to
31b5645
Compare
31b5645 to
db027a4
Compare
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.
What
Ports over the graceful shutdown logic from fjall-wip branch: https://github.com/Cuprate/cuprate/blob/fjall-wip/binaries/cuprated/src/monitor.rs
Depends on the embeddable version #592
Why
More idiomatic shutdown pattern, previously every exit was equivalent to a crash
Where
cuprated:monitor.rs-TaskExecutorhandle, signal handler, force-quit on double Ctrl+Cmain.rs- wires up executor, shutdown wait loopcommands.rs- addExitcommandblockchain/manager.rs, syncer.rs- shutdown token inselectloops, replacetodo!()withbreaktxpool/manager.rs, incoming_tx.rs- shutdown token, change ordering by priority due to usingbiasedrpc/server.rs, rpc_handler.rs-with_graceful_shutdown, tracked spawns, carries shutdown tokenrpc/handlers/other_json.rs- wiring forstop_daemonRPClib.rs-Node::launchreturnsResult, creates and distributesTaskExecutorHow
monitor.rsintroducesTaskExecutor, took nomenclature inspo from reth. Instead of how reth does it though with a static, its threaded into the functions to support running multipleNodeinstances in the same processAll
tokio::spawnreplaced withTaskExecutor::spawn. Task select loops now usebiasedordering with the shutdown token as higher priority.On shutdown signal, the token is cancelled -> tasks wind down one by one, and
main()waits on task tracker to finish unwinding before dropping the runtime.Node::launchnow returnsResult<Self, anyhow::Error>instead of panicking on database/service init failures.Double Ctrl+C force exits.