@@ -55,6 +55,7 @@ impl ManifestCache {
5555 local_store : ObjectStore ,
5656 capacity : ReadableSize ,
5757 ttl : Option < Duration > ,
58+ recover_sync : bool ,
5859 ) -> ManifestCache {
5960 let total_capacity = capacity. as_bytes ( ) ;
6061
@@ -67,8 +68,8 @@ impl ManifestCache {
6768
6869 let cache = ManifestCache { local_store, index } ;
6970
70- // Recovers the cache index from local store asynchronously
71- cache. recover ( false ) . await ;
71+ // Recovers the cache index from local store.
72+ cache. recover ( recover_sync ) . await ;
7273
7374 cache
7475 }
@@ -483,7 +484,7 @@ mod tests {
483484 let dir = create_temp_dir ( "" ) ;
484485 let local_store = new_fs_store ( dir. path ( ) . to_str ( ) . unwrap ( ) ) ;
485486
486- let cache = ManifestCache :: new ( local_store. clone ( ) , ReadableSize :: mb ( 10 ) , None ) . await ;
487+ let cache = ManifestCache :: new ( local_store. clone ( ) , ReadableSize :: mb ( 10 ) , None , true ) . await ;
487488 let key = "region_1/manifest/00000000000000000007.json" ;
488489 let file_path = cache. cache_file_path ( key) ;
489490
@@ -527,7 +528,7 @@ mod tests {
527528
528529 let dir = create_temp_dir ( "" ) ;
529530 let local_store = new_fs_store ( dir. path ( ) . to_str ( ) . unwrap ( ) ) ;
530- let cache = ManifestCache :: new ( local_store. clone ( ) , ReadableSize :: mb ( 10 ) , None ) . await ;
531+ let cache = ManifestCache :: new ( local_store. clone ( ) , ReadableSize :: mb ( 10 ) , None , true ) . await ;
531532
532533 // Write some manifest files with different paths
533534 let keys = [
@@ -559,10 +560,7 @@ mod tests {
559560 }
560561
561562 // Create a new cache instance which will automatically recover from local store
562- let cache = ManifestCache :: new ( local_store. clone ( ) , ReadableSize :: mb ( 10 ) , None ) . await ;
563-
564- // Wait for recovery to complete synchronously
565- cache. recover ( true ) . await ;
563+ let cache = ManifestCache :: new ( local_store. clone ( ) , ReadableSize :: mb ( 10 ) , None , true ) . await ;
566564
567565 // Check size.
568566 cache. index . run_pending_tasks ( ) . await ;
@@ -580,7 +578,7 @@ mod tests {
580578 async fn test_cache_file_path ( ) {
581579 let dir = create_temp_dir ( "" ) ;
582580 let local_store = new_fs_store ( dir. path ( ) . to_str ( ) . unwrap ( ) ) ;
583- let cache = ManifestCache :: new ( local_store, ReadableSize :: mb ( 10 ) , None ) . await ;
581+ let cache = ManifestCache :: new ( local_store, ReadableSize :: mb ( 10 ) , None , true ) . await ;
584582
585583 assert_eq ! (
586584 "cache/object/manifest/region_1/manifest/00000000000000000007.json" ,
0 commit comments