From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager v2 1/7] server: task cache: treat a limit of 0 as unbounded
Date: Wed, 19 Feb 2025 13:28:18 +0100 [thread overview]
Message-ID: <20250219122824.2043990-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250219122824.2043990-1-d.csapak@proxmox.com>
like we do in our other products e.g. like PBS
This way, one can specify a way to return *all* tasks.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
server/src/task_cache.rs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/server/src/task_cache.rs b/server/src/task_cache.rs
index 7ded540..4c34827 100644
--- a/server/src/task_cache.rs
+++ b/server/src/task_cache.rs
@@ -56,6 +56,11 @@ pub async fn get_tasks(max_age: i64, filters: TaskFilters) -> Result<Vec<TaskLis
}
}
+ let limit = match filters.limit {
+ 0 => usize::MAX,
+ limit => limit as usize,
+ };
+
let mut returned_tasks = add_running_tasks(all_tasks)?;
returned_tasks.sort_by(|a, b| b.starttime.cmp(&a.starttime));
let returned_tasks = returned_tasks
@@ -105,7 +110,7 @@ pub async fn get_tasks(max_age: i64, filters: TaskFilters) -> Result<Vec<TaskLis
true
})
.skip(filters.start as usize)
- .take(filters.limit as usize)
+ .take(limit)
.collect();
// We don't need to wait for this task to finish
--
2.39.5
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-02-19 12:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-19 12:28 [pdm-devel] [PATCH datacenter-manager v2 0/7] add task summary panels in dashboard Dominik Csapak
2025-02-19 12:28 ` Dominik Csapak [this message]
2025-02-19 12:28 ` [pdm-devel] [PATCH datacenter-manager v2 2/7] server: api: remote tasks: add 'remote' filter option Dominik Csapak
2025-02-19 12:28 ` [pdm-devel] [PATCH datacenter-manager v2 3/7] server: api: add remote-tasks statistics Dominik Csapak
2025-02-19 12:28 ` [pdm-devel] [PATCH datacenter-manager v2 4/7] ui: refactor remote upid formatter Dominik Csapak
2025-02-19 12:28 ` [pdm-devel] [PATCH datacenter-manager v2 5/7] ui: tasks: add helper to summarize task categories Dominik Csapak
2025-02-19 12:28 ` [pdm-devel] [PATCH datacenter-manager v2 6/7] ui: add dialog to show filtered tasks Dominik Csapak
2025-02-19 12:28 ` [pdm-devel] [PATCH datacenter-manager v2 7/7] ui: dashboard: add task summaries 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=20250219122824.2043990-2-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pdm-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.