mirror of
https://github.com/chatmail/core.git
synced 2026-04-28 02:46:29 +03:00
ref: make Context::alloc_ongoing return a guard
This guard can be awaited and will resolve when Context::stop_ongoing is called, i.e. the ongoing process is cancelled. The guard will also free the ongoing process when dropped, making it RAII and easier to not accidentally free the ongoing process.
This commit is contained in:
@@ -94,7 +94,7 @@ pub async fn imex(
|
||||
let _guard = context.scheduler.pause(context.clone()).await;
|
||||
imex_inner(context, what, path, passphrase)
|
||||
.race(async {
|
||||
cancel.recv().await.ok();
|
||||
cancel.await;
|
||||
Err(format_err!("canceled"))
|
||||
})
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user