[yew-devel] [PATCH yew-comp 2/4] http helpers: expose ticket refresh loop controls
Dominik Csapak
d.csapak at proxmox.com
Tue Jul 1 10:38:57 CEST 2025
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 <d.csapak at proxmox.com>
---
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<Option<AsyncAbortGuard>> = 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
More information about the yew-devel
mailing list