Added prefetch
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user