From: Dominik Csapak <d.csapak@proxmox.com>
To: Lukas Wagner <l.wagner@proxmox.com>,
Proxmox Datacenter Manager development discussion
<pdm-devel@lists.proxmox.com>
Subject: Re: [pdm-devel] [PATCH proxmox-datacenter-manager v5 2/6] remote tasks: add background task for task polling, use new task cache
Date: Thu, 3 Jul 2025 13:25:40 +0200 [thread overview]
Message-ID: <66b31285-5ea2-45a3-b76a-d57469636c1b@proxmox.com> (raw)
In-Reply-To: <4226966c-dd23-4bcf-9ecf-2f129bf1a07b@proxmox.com>
On 7/3/25 10:05, Lukas Wagner wrote:
[snip]
>>> + .collect())
>>> + }
>>> +}
>>> +
>>> +/// Get the timestamp from which on we should fetch tasks for a given remote.
>>> +/// The returned timestamp is a UNIX timestamp (in seconds).
>>> +fn get_cutoff_timestamp(remote: &Remote, state: &State) -> i64 {
>>> + let oldest_active = state.oldest_active_task.get(&remote.id).copied();
>>> + let youngest_archived = state.most_recent_archive_starttime.get(&remote.id).copied();
>>> +
>>> + match (oldest_active, youngest_archived) {
>>> + (None, None) => 0,
>>> + (None, Some(youngest_archived)) => youngest_archived,
>>> + (Some(oldest_active), None) => oldest_active,
>>> + (Some(oldest_active), Some(youngest_active)) => oldest_active.min(youngest_active),
>>> + }
>>> +}
>>> +
>>> +/// Rotate the task cache if necessary.
>>> +///
>>> +/// Returns Ok(true) the cache's files were rotated.
>>> +async fn rotate_cache(cache: TaskCache) -> Result<bool, Error> {
>>> + tokio::task::spawn_blocking(move || {
>>> + cache.rotate(
>>> + proxmox_time::epoch_i64(),
>>> + ROTATE_AFTER.as_secs(),
>>> + KEEP_OLD_FILES,
>>> + )
>>> + })
>>> + .await?
>>> +}
>>
>> in pbs, we start a worker task for the log rotation, maybe we want here too ?
>>
>
> Hmmm, do we have any guidelines when something should be a worker task and when not?
> I'm not opposed to it, but I'm just curious where to draw the line.
> Also, being a worker task also implies that it can be cancelled, right? Does that make sense for
> something like this?
>
no guidelines, but IMHO it makes sense if the task can take longer (e.g. when writing to disk)
and it's interesting for the user that it actually runs (and when).
also no, it does not make sense for it to be aborted really.
in any case, it might be enough here when we log into the syslog. creating a worker
can always be done later too
_______________________________________________
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-07-03 11:25 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-12 11:41 [pdm-devel] [PATCH proxmox-datacenter-manager v5 0/6] remote task cache fetching task / better cache backend Lukas Wagner
2025-05-12 11:41 ` [pdm-devel] [PATCH proxmox-datacenter-manager v5 1/6] remote tasks: implement improved cache for remote tasks Lukas Wagner
2025-05-14 14:08 ` Dominik Csapak
2025-07-01 10:02 ` Lukas Wagner
2025-07-03 8:05 ` Lukas Wagner
2025-05-12 11:41 ` [pdm-devel] [PATCH proxmox-datacenter-manager v5 2/6] remote tasks: add background task for task polling, use new task cache Lukas Wagner
2025-05-14 15:27 ` Dominik Csapak
2025-07-03 8:05 ` Lukas Wagner
2025-07-03 11:25 ` Dominik Csapak [this message]
2025-07-09 11:22 ` Lukas Wagner
2025-07-09 11:35 ` Dominik Csapak
2025-07-09 12:25 ` Lukas Wagner
2025-05-12 11:41 ` [pdm-devel] [PATCH proxmox-datacenter-manager v5 3/6] remote tasks: improve locking for task archive iterator Lukas Wagner
2025-05-12 11:41 ` [pdm-devel] [PATCH proxmox-datacenter-manager v5 4/6] pdm-api-types: remote tasks: add new_from_str constructor for TaskStateType Lukas Wagner
2025-05-15 6:56 ` Dominik Csapak
2025-05-12 11:41 ` [pdm-devel] [PATCH proxmox-datacenter-manager v5 5/6] fake remote: make the fake_remote feature compile again Lukas Wagner
2025-05-15 6:55 ` Dominik Csapak
2025-05-12 11:41 ` [pdm-devel] [PATCH proxmox-datacenter-manager v5 6/6] fake remote: clippy fixes Lukas Wagner
2025-05-15 7:05 ` Dominik Csapak
2025-08-14 8:04 ` [pdm-devel] superseded: [PATCH proxmox-datacenter-manager v5 0/6] remote task cache fetching task / better cache backend Lukas Wagner
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=66b31285-5ea2-45a3-b76a-d57469636c1b@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=l.wagner@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox