server: refactor abort_local_worker
we'll need this outside the module Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
84af82e8cf
commit
3f742f952a
@ -100,9 +100,8 @@ pub fn register_task_control_commands(
|
|||||||
commando_sock.register_command("worker-task-abort".into(), move |args| {
|
commando_sock.register_command("worker-task-abort".into(), move |args| {
|
||||||
let upid = get_upid(args)?;
|
let upid = get_upid(args)?;
|
||||||
|
|
||||||
if let Some(ref worker) = WORKER_TASK_LIST.lock().unwrap().get(&upid.task_id) {
|
abort_local_worker(upid);
|
||||||
worker.request_abort();
|
|
||||||
}
|
|
||||||
Ok(Value::Null)
|
Ok(Value::Null)
|
||||||
})?;
|
})?;
|
||||||
commando_sock.register_command("worker-task-status".into(), move |args| {
|
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(())
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user