Merge 1.112.7 into master

This commit is contained in:
link2xt
2023-04-17 15:24:15 +00:00
11 changed files with 44 additions and 40 deletions

View File

@@ -256,7 +256,7 @@ enum RunningState {
Running { cancel_sender: Sender<()> },
/// Cancel signal has been sent, waiting for ongoing process to be freed.
ShallStop,
ShallStop { request: Instant },
/// There is no ongoing process, a new one can be allocated.
Stopped,
@@ -509,6 +509,9 @@ impl Context {
pub(crate) async fn free_ongoing(&self) {
let mut s = self.running_state.write().await;
if let RunningState::ShallStop { request } = *s {
info!(self, "Ongoing stopped in {:?}", request.elapsed());
}
*s = RunningState::Stopped;
}
@@ -521,9 +524,11 @@ impl Context {
warn!(self, "could not cancel ongoing: {:#}", err);
}
info!(self, "Signaling the ongoing process to stop ASAP.",);
*s = RunningState::ShallStop;
*s = RunningState::ShallStop {
request: Instant::now(),
};
}
RunningState::ShallStop | RunningState::Stopped => {
RunningState::ShallStop { .. } | RunningState::Stopped => {
info!(self, "No ongoing process to stop.",);
}
}
@@ -533,7 +538,7 @@ impl Context {
pub(crate) async fn shall_stop_ongoing(&self) -> bool {
match &*self.running_state.read().await {
RunningState::Running { .. } => false,
RunningState::ShallStop | RunningState::Stopped => true,
RunningState::ShallStop { .. } | RunningState::Stopped => true,
}
}