[pbs-devel] [PATCH proxmox-backup v4 1/7] server: refactor abort_local_worker
Dominik Csapak
d.csapak at proxmox.com
Tue Sep 21 12:11:12 CEST 2021
we'll need this outside the module
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/server/worker_task.rs | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/server/worker_task.rs b/src/server/worker_task.rs
index 565ce154..a74b18e1 100644
--- a/src/server/worker_task.rs
+++ b/src/server/worker_task.rs
@@ -100,9 +100,8 @@ pub fn register_task_control_commands(
commando_sock.register_command("worker-task-abort".into(), move |args| {
let upid = get_upid(args)?;
- if let Some(ref worker) = WORKER_TASK_LIST.lock().unwrap().get(&upid.task_id) {
- worker.request_abort();
- }
+ abort_local_worker(upid);
+
Ok(Value::Null)
})?;
commando_sock.register_command("worker-task-status".into(), move |args| {
@@ -828,3 +827,10 @@ pub async fn wait_for_local_worker(upid_str: &str) -> Result<(), Error> {
}
Ok(())
}
+
+/// Request abort of a local worker (if existing and running)
+pub fn abort_local_worker(upid: UPID) {
+ if let Some(ref worker) = WORKER_TASK_LIST.lock().unwrap().get(&upid.task_id) {
+ worker.request_abort();
+ }
+}
--
2.30.2
More information about the pbs-devel
mailing list