From: Dominik Csapak Date: Tue, 15 Sep 2020 09:15:01 +0000 (+0200) Subject: api2/pull: make pull worker abortable X-Git-Tag: v0.8.17~27 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=36700a0a8761990e01735ba88fb88706db43494b;p=proxmox-backup.git api2/pull: make pull worker abortable by selecting between the pull_future and the abort future Signed-off-by: Dominik Csapak --- diff --git a/src/api2/pull.rs b/src/api2/pull.rs index fc13cf40..09e27a17 100644 --- a/src/api2/pull.rs +++ b/src/api2/pull.rs @@ -176,7 +176,13 @@ async fn pull ( worker.log(format!("sync datastore '{}' start", store)); - pull_store(&worker, &client, &src_repo, tgt_store.clone(), delete, userid).await?; + let pull_future = pull_store(&worker, &client, &src_repo, tgt_store.clone(), delete, userid); + let future = select!{ + success = pull_future.fuse() => success, + abort = worker.abort_future().map(|_| Err(format_err!("pull aborted"))) => abort, + }; + + let _ = future?; worker.log(format!("sync datastore '{}' end", store));