all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
	Proxmox Datacenter Manager development discussion
	<pdm-devel@lists.proxmox.com>
Subject: Re: [pdm-devel] [PATCH proxmox-datacenter-manager 5/8] remote tasks: add background task for task polling, use new task cache
Date: Fri, 11 Apr 2025 10:03:19 +0200	[thread overview]
Message-ID: <0ef390cb-95a9-4d99-bae5-99a5a775effb@proxmox.com> (raw)
In-Reply-To: <9947a9f1-bd50-4ae5-90d9-203dff5b0cb7@proxmox.com>

On  2025-03-20 18:39, Thomas Lamprecht wrote:
[...]
>>  
>>  use crate::{api::pve, task_utils};
>>  
>>  mod task_cache;
>>  
>> +const REMOTE_TASKS_DIR: &str = concat!(pdm_buildcfg::PDM_CACHE_DIR_M!(), "/remote-tasks");
>> +
>> +const SECONDS_PER_MINUTE: u64 = 60;
>> +const MINUTES_PER_HOUR: u64 = 60;
> While technically correct this reads like a rate and makes it IMO a bit
> harder to tell what is meant in below calculations.
> 
> I'd either use Duration from std, like e.g. Duration::from_mins(10).as_secs()
> and Duration::from_hours(1).as_secs() respectively for REGULAR_REFRESH_S and
> CHECK_ROTATE_S below or just 60 and 3600, those values are pretty much general
> knowledge, which might be a part of the confusion potential I see in your
> variant, as I basically expect that this has to be something more elaborate or
> why  would it go for this seemingly complex variant.
> That said, using what the std lib already provides is totally fine here.
> 

Finally got the time to incorporate your feedback for a v2.
As it turns out, Duration::from_mins/from_hours is actually
still nightly-only...

https://doc.rust-lang.org/std/time/struct.Duration.html#method.from_mins

Anyway, I'll still change these up a bit; I'll use `Duration` for anything
that is a time interval and then use `Duration::as_secs` for
the cycle calculations. This should make it a bit more idiomatic and
less error-prone.


-- 
- Lukas



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  parent reply	other threads:[~2025-04-11  8:03 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 14:12 [pdm-devel] [PATCH proxmox-datacenter-manager 0/8] remote task cache fetching task / better cache backend Lukas Wagner
2025-03-14 14:12 ` [pdm-devel] [PATCH proxmox-datacenter-manager 1/8] test support: add NamedTempFile helper Lukas Wagner
2025-04-09 12:50   ` [pdm-devel] applied: " Thomas Lamprecht
2025-03-14 14:12 ` [pdm-devel] [PATCH proxmox-datacenter-manager 2/8] test support: add NamedTempDir helper Lukas Wagner
2025-04-09 12:50   ` [pdm-devel] applied: " Thomas Lamprecht
2025-03-14 14:12 ` [pdm-devel] [PATCH proxmox-datacenter-manager 3/8] move task_cache.rs to remote_tasks/mod.rs Lukas Wagner
2025-04-09 12:50   ` [pdm-devel] applied: " Thomas Lamprecht
2025-03-14 14:12 ` [pdm-devel] [PATCH proxmox-datacenter-manager 4/8] remote tasks: implement improved cache for remote tasks Lukas Wagner
2025-03-14 14:12 ` [pdm-devel] [PATCH proxmox-datacenter-manager 5/8] remote tasks: add background task for task polling, use new task cache Lukas Wagner
2025-03-20 17:39   ` Thomas Lamprecht
2025-03-21 13:33     ` Lukas Wagner
2025-03-21 13:39     ` Max Carrara
2025-04-11  8:03     ` Lukas Wagner [this message]
2025-03-14 14:12 ` [pdm-devel] [PATCH proxmox-datacenter-manager 6/8] pdm-api-types: remote tasks: implement From<&str> for TaskStateType Lukas Wagner
2025-03-14 14:12 ` [pdm-devel] [PATCH proxmox-datacenter-manager 7/8] fake remote: add missing fields to make the debug feature compile again Lukas Wagner
2025-04-09 12:52   ` [pdm-devel] applied: " Thomas Lamprecht
2025-03-14 14:12 ` [pdm-devel] [PATCH proxmox-datacenter-manager 8/8] fake remote: generate fake task data Lukas Wagner
2025-04-09 12:52   ` [pdm-devel] applied: " Thomas Lamprecht
2025-04-11 11:02 ` [pdm-devel] superseded: [PATCH proxmox-datacenter-manager 0/8] 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=0ef390cb-95a9-4d99-bae5-99a5a775effb@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    --cc=t.lamprecht@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