From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D57601FF16B for ; Tue, 1 Jul 2025 10:38:24 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 36248395CD; Tue, 1 Jul 2025 10:39:04 +0200 (CEST) From: Dominik Csapak To: yew-devel@lists.proxmox.com Date: Tue, 1 Jul 2025 10:38:57 +0200 Message-Id: <20250701083859.2088138-2-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250701083859.2088138-1-d.csapak@proxmox.com> References: <20250701083859.2088138-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.022 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 Subject: [yew-devel] [PATCH yew-comp 2/4] http helpers: expose ticket refresh loop controls X-BeenThere: yew-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Yew framework devel list at Proxmox List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Yew framework devel list at Proxmox Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: yew-devel-bounces@lists.proxmox.com Sender: "yew-devel" by introducing a stop_ticket_refresh_loop and making both start and stop public. This can be useful e.g. when such a ticket refresh loop is unwanted. This is the case for example for the PMG quarantine interface when using a PMGQUAR ticket, since that is valid as long as the quarantine is valid and refreshing it simply yields the same ticket. Signed-off-by: Dominik Csapak --- src/http_helpers.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/http_helpers.rs b/src/http_helpers.rs index d035b48..94cc078 100644 --- a/src/http_helpers.rs +++ b/src/http_helpers.rs @@ -85,13 +85,17 @@ thread_local! { static TICKET_REFRESH_LOOP_GUARD: RefCell> = const { RefCell::new(None) }; } -fn start_ticket_refresh_loop() { +pub fn start_ticket_refresh_loop() { let abort_guard = AsyncAbortGuard::spawn(ticket_refresh_loop()); // Make sure there is a single loop running. TICKET_REFRESH_LOOP_GUARD.with_borrow_mut(|v| *v = Some(abort_guard)); } +pub fn stop_ticket_refresh_loop() { + TICKET_REFRESH_LOOP_GUARD.with_borrow_mut(|v| *v = None); +} + async fn ticket_refresh_loop() { loop { let sleep_time_ms = 5000; -- 2.39.5 _______________________________________________ yew-devel mailing list yew-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel