From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 726A91FF13F for ; Thu, 07 May 2026 15:23:38 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4A5981D007; Thu, 7 May 2026 15:23:35 +0200 (CEST) Content-Type: text/plain; charset=UTF-8 Date: Thu, 07 May 2026 15:23:27 +0200 Message-Id: Subject: Re: [PATCH datacenter-manager v2 1/8] api: subscription cache: ensure max_age=0 forces a fresh fetch From: "Lukas Wagner" To: "Thomas Lamprecht" , Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.21.0-0-g5549850facc2-dirty References: <20260507082943.2749725-1-t.lamprecht@proxmox.com> <20260507082943.2749725-2-t.lamprecht@proxmox.com> In-Reply-To: <20260507082943.2749725-2-t.lamprecht@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778160099471 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.054 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [resources.rs] Message-ID-Hash: WGUZRAO7YBM2AVJ3XFBUNOYTDSVKXIJY X-Message-ID-Hash: WGUZRAO7YBM2AVJ3XFBUNOYTDSVKXIJY X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu May 7, 2026 at 10:26 AM CEST, Thomas Lamprecht wrote: > The cache lookup used 'diff > max_age', so a same-second hit with > max_age=3D0 still returned cached data; collect_status_uncached and the > direct user-supplied ?max-age=3D0 bypass both silently lost their > freshness guarantee. Short-circuit max_age=3D0 explicitly and switch the > TTL comparison to '>=3D' so the boundary is an exact miss. > > Signed-off-by: Thomas Lamprecht > --- > > This threw me off quite a bit, as I observed seemingly stale cache > issues, which where ultimately due to something completely different. > > server/src/api/resources.rs | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs > index 04628a8..50315b1 100644 > --- a/server/src/api/resources.rs > +++ b/server/src/api/resources.rs > @@ -830,11 +830,14 @@ fn get_cached_subscription_info(remote: &str, max_a= ge: u64) -> Option .read() > .expect("subscription mutex poisoned"); > =20 > + if max_age =3D=3D 0 { > + return None; > + } > if let Some(cached_subscription) =3D cache.get(remote) { > let now =3D proxmox_time::epoch_i64(); > let diff =3D now - cached_subscription.timestamp; > =20 > - if diff > max_age as i64 || diff < 0 { > + if diff >=3D max_age as i64 || diff < 0 { > // value is too old or from the future > None > } else { Reviewed-by: Lukas Wagner