Added prefetch

This commit is contained in:
2026-03-13 18:06:54 +00:00
parent 078698154e
commit 9c55dce5a1
3 changed files with 12 additions and 6 deletions

View File

@@ -193,14 +193,13 @@ impl FurumiClient {
.time_to_live(Duration::from_secs(30))
.build();
let this = Self { client, attr_cache, dir_cache };
this.start_background_sync();
Ok(this)
Ok(Self { client, attr_cache, dir_cache })
}
/// Spawns background tasks that pre-warm the cache with a server snapshot and then
/// subscribe to live change events to keep it up to date.
fn start_background_sync(&self) {
/// Must be called after a successful authentication check.
pub fn start_background_sync(&self) {
let this = self.clone();
tokio::spawn(async move {
match this.load_snapshot("/", 3).await {