From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup v3 1/7] server: refactor abort_local_worker
Date: Fri, 17 Sep 2021 13:56:01 +0200 [thread overview]
Message-ID: <20210917115607.135162-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20210917115607.135162-1-d.csapak@proxmox.com>
we'll need this outside the module
Signed-off-by: Dominik Csapak <d.csapak@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 2ef8ba9d..c4696a2f 100644
--- a/src/server/worker_task.rs
+++ b/src/server/worker_task.rs
@@ -102,9 +102,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| {
@@ -841,3 +840,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
next prev parent reply other threads:[~2021-09-17 11:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-17 11:56 [pbs-devel] [PATCH proxmox-backup v3 0/7] add 'proxmox-backup-debug api' commands Dominik Csapak
2021-09-17 11:56 ` Dominik Csapak [this message]
2021-09-17 11:56 ` [pbs-devel] [PATCH proxmox-backup v3 2/7] move proxmox-backup-debug back to main crate Dominik Csapak
2021-09-17 11:56 ` [pbs-devel] [PATCH proxmox-backup v3 3/7] proxmox-backup-debug: add 'api' subcommands Dominik Csapak
2021-09-17 11:56 ` [pbs-devel] [PATCH proxmox-backup v3 4/7] api2: add missing token list match_all property Dominik Csapak
2021-09-17 11:56 ` [pbs-devel] [PATCH proxmox-backup v3 5/7] api2: make some workers log on CLI Dominik Csapak
2021-09-17 11:56 ` [pbs-devel] [PATCH proxmox-backup v3 6/7] docs: add proxmox-backup-debug to the list of command line tools Dominik Csapak
2021-09-17 11:56 ` [pbs-devel] [PATCH proxmox-backup v3 7/7] docs: proxmox-backup-debug: add info about the 'api' subcommand Dominik Csapak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210917115607.135162-2-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal