api2/pull: make pull worker abortable
by selecting between the pull_future and the abort future Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
dd4b42bac1
commit
36700a0a87
|
@ -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));
|
||||
|
||||
|
|
Loading…
Reference in New Issue