From c87b05875c3f2edc970c21d3be6e40b244dde5ce Mon Sep 17 00:00:00 2001 From: 2clerway Date: Sat, 30 May 2026 17:35:24 +0200 Subject: [PATCH] fix: cache background refresh infinite loop during init Only spawn cache background refresh tasks when State is already initialized. Prevents the spawned task from hang forever in the State::get() busy-wait loop when it fires before init completes. --- packages/app-lib/src/state/cache.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/app-lib/src/state/cache.rs b/packages/app-lib/src/state/cache.rs index 9936c99626..366bf53fb9 100644 --- a/packages/app-lib/src/state/cache.rs +++ b/packages/app-lib/src/state/cache.rs @@ -971,6 +971,7 @@ impl CachedEntry { && (cache_behaviour == CacheBehaviour::StaleWhileRevalidate || cache_behaviour == CacheBehaviour::StaleWhileRevalidateSkipOffline) + && crate::state::State::initialized() { tokio::task::spawn(async move { // TODO: if possible- find a way to do this without invoking state get