simplify prefetch_rate_limits

This commit is contained in:
kevin zhao
2025-11-17 13:23:05 -08:00
parent 58ce6bcfb5
commit 82f49f4b4e

View File

@@ -1763,15 +1763,11 @@ impl ChatWidget {
tokio::spawn(async move {
let mut interval = tokio::time::interval(Duration::from_secs(60));
if let Some(snapshot) = fetch_rate_limits(base_url.clone(), auth.clone()).await {
app_event_tx.send(AppEvent::RateLimitSnapshotFetched(snapshot));
}
loop {
interval.tick().await;
if let Some(snapshot) = fetch_rate_limits(base_url.clone(), auth.clone()).await {
app_event_tx.send(AppEvent::RateLimitSnapshotFetched(snapshot));
}
interval.tick().await;
}
});
}