Skip to content

Commit d646c06

Browse files
feat: update is_cache_ready to check if cache is at least 90% full
Co-Authored-By: Tejas Badadare <[email protected]>
1 parent fbcef36 commit d646c06

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

apps/hermes/server/src/state/cache.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,12 @@ where
276276
Ok(cache.get(&slot).cloned())
277277
}
278278

279+
///
279280
async fn is_cache_ready(&self) -> bool {
280281
let message_cache = self.into().message_cache.read().await;
281-
!message_cache.is_empty()
282+
let cache_size = self.into().cache_size as usize;
283+
284+
message_cache.len() >= (cache_size * 9 / 10)
282285
}
283286
}
284287

0 commit comments

Comments
 (0)