From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] fix cross process task listing
Date: Thu, 9 Jul 2020 15:05:11 +0200 [thread overview]
Message-ID: <20200709130511.8361-1-d.csapak@proxmox.com> (raw)
it does not make sense to check if the worker is running if we already
have an endtime and state
our 'worker_is_active_local' heuristic returns true for non
process-local tasks, so we got 'running' for all tasks that were not
started by 'our' pid and were still running
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/server/worker_task.rs | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)
diff --git a/src/server/worker_task.rs b/src/server/worker_task.rs
index 72c594e..af6686f 100644
--- a/src/server/worker_task.rs
+++ b/src/server/worker_task.rs
@@ -270,28 +270,22 @@ fn update_active_workers(new_upid: Option<&UPID>) -> Result<Vec<TaskListInfo>, E
let line = line?;
match parse_worker_status_line(&line) {
Err(err) => bail!("unable to parse active worker status '{}' - {}", line, err),
- Ok((upid_str, upid, state)) => {
-
- let running = worker_is_active_local(&upid);
-
- if running {
+ Ok((upid_str, upid, state)) => match state {
+ None if worker_is_active_local(&upid) => {
active_list.push(TaskListInfo { upid, upid_str, state: None });
- } else {
- match state {
- None => {
- println!("Detected stopped UPID {}", upid_str);
- let status = upid_read_status(&upid)
- .unwrap_or_else(|_| String::from("unknown"));
- finish_list.push(TaskListInfo {
- upid, upid_str, state: Some((Local::now().timestamp(), status))
- });
- }
- Some((endtime, status)) => {
- finish_list.push(TaskListInfo {
- upid, upid_str, state: Some((endtime, status))
- })
- }
- }
+ },
+ None => {
+ println!("Detected stopped UPID {}", upid_str);
+ let status = upid_read_status(&upid)
+ .unwrap_or_else(|_| String::from("unknown"));
+ finish_list.push(TaskListInfo {
+ upid, upid_str, state: Some((Local::now().timestamp(), status))
+ });
+ },
+ Some((endtime, status)) => {
+ finish_list.push(TaskListInfo {
+ upid, upid_str, state: Some((endtime, status))
+ })
}
}
}
--
2.20.1
reply other threads:[~2020-07-09 13:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200709130511.8361-1-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox