Wait for background workers before finish notices and cancel tools on shutdown
This commit is contained in:
@@ -24,6 +24,7 @@ pub enum Input {
|
||||
reply: mpsc::UnboundedSender<Value>,
|
||||
},
|
||||
Stop,
|
||||
Shutdown,
|
||||
}
|
||||
|
||||
pub type Sender = mpsc::UnboundedSender<Input>;
|
||||
@@ -78,7 +79,8 @@ pub(super) fn console(sender: Sender) {
|
||||
});
|
||||
}
|
||||
|
||||
pub(super) fn stop_signal(
|
||||
/// Register SIGTERM and SIGINT before the harness starts.
|
||||
pub fn stop_signal(
|
||||
sender: Sender,
|
||||
) -> std::io::Result<impl std::future::Future<Output = ()> + Send> {
|
||||
// Register before V8 starts, so a stop cannot arrive before the listener.
|
||||
@@ -89,6 +91,6 @@ pub(super) fn stop_signal(
|
||||
_ = interrupt.recv() => {}
|
||||
_ = terminate.recv() => {}
|
||||
}
|
||||
let _ = sender.send(Input::Stop);
|
||||
let _ = sender.send(Input::Shutdown);
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user