Remove Context::free_ongoing function

This is now handled better by the Drop from the OngoingGuard returned
by Context::alloc_ongoing.
This commit is contained in:
Floris Bruynooghe
2023-03-30 10:52:47 +02:00
parent 0c5d1832ae
commit 201d05d4fa
4 changed files with 14 additions and 35 deletions

View File

@@ -88,18 +88,17 @@ pub async fn imex(
path: &Path,
passphrase: Option<String>,
) -> Result<()> {
let cancel = context.alloc_ongoing().await?;
let ongoing_guard = context.alloc_ongoing().await?;
let res = {
let _guard = context.scheduler.pause(context.clone()).await;
imex_inner(context, what, path, passphrase)
.race(async {
cancel.await;
ongoing_guard.await;
Err(format_err!("canceled"))
})
.await
};
context.free_ongoing().await;
if let Err(err) = res.as_ref() {
// We are using Anyhow's .context() and to show the inner error, too, we need the {:#}: