Log error on pause guard drop without resuming instead of working around

I checked that tests still pass even if error! is replaced with panic!
This commit is contained in:
link2xt
2023-03-19 10:13:59 +00:00
parent a2e7d914a0
commit 81418d8ee5

View File

@@ -219,14 +219,9 @@ impl<'a> Drop for IoPausedGuard<'a> {
if self.done {
return;
}
let context = self.context.clone();
tokio::spawn(async move {
let mut inner = context.scheduler.inner.write().await;
inner.paused = false;
if inner.started && inner.scheduler.is_none() {
SchedulerState::do_start(inner, context.clone()).await;
}
});
// Async .resume() should be called manually due to lack of async drop.
error!(self.context, "Pause guard dropped without resuming.");
}
}