reth
reth copied to clipboard
exit forcefully if ctrl-c is Hit multiple times
Describe the feature
one ctrl-c triggers a graceful shutdown. double tap should exit immediately
Additional context
No response
I'd like to take this
nice, this is a bit challenging and I'm not quite sure yet how that would, this would require playing around tokio task internals a bit.
yeah, this will take a while, I guess I knock out easier issues, while I sort this out.
okay I think I know how to do this after reading https://tokio.rs/tokio/topics/shutdown
we need to make a few changes:
add async fn TaskExecutor::shutdown in which we drop the signal and also await on a new graceful shutdown channel that is used in spawn_with_signal that then can send back a response.
Do we create a new signal in async fn TaskExecutor::shutdown or pass the one from TaskManager to it. Also, the Tokio example uses a mpsc::channel while the current implementation uses one shot::channel, wouldn't that need changing
we need a new unbounded channel and we need to add a new GracefulShutdown struct that's Shutdown+ Sender<()>
the TaskManager holds the receiver and awaits until channel is done, which means all GracefulShutdown have been dropped.
IMO we can close - this can potentially cause DB corruptions or not properly disconnect from all peers, and I'd rather avoid uncleaned state.