File tree Expand file tree Collapse file tree 1 file changed +20
-12
lines changed Expand file tree Collapse file tree 1 file changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -388,6 +388,7 @@ impl HotTierManager {
388
388
. join ( "hottier.manifest.json" ) ;
389
389
fs:: create_dir_all ( manifest_path. parent ( ) . unwrap ( ) ) . await ?;
390
390
fs:: write ( manifest_path, serde_json:: to_vec ( & hot_tier_manifest) ?) . await ?;
391
+
391
392
Ok ( file_processed)
392
393
}
393
394
@@ -413,21 +414,28 @@ impl HotTierManager {
413
414
pub async fn fetch_hot_tier_dates ( & self , stream : & str ) -> Result < Vec < NaiveDate > , HotTierError > {
414
415
let mut date_list = Vec :: new ( ) ;
415
416
let path = self . hot_tier_path . join ( stream) ;
416
- if path. exists ( ) {
417
- let directories = ReadDirStream :: new ( fs:: read_dir ( & path) . await ?) ;
418
- let dates: Vec < DirEntry > = directories. try_collect ( ) . await ?;
419
- for date in dates {
420
- if !date. path ( ) . is_dir ( ) {
421
- continue ;
422
- }
423
- let date = date. file_name ( ) . into_string ( ) . unwrap ( ) ;
424
- date_list. push (
425
- NaiveDate :: parse_from_str ( date. trim_start_matches ( "date=" ) , "%Y-%m-%d" )
426
- . unwrap ( ) ,
427
- ) ;
417
+ if !path. exists ( ) {
418
+ return Ok ( date_list) ;
419
+ }
420
+
421
+ let directories = fs:: read_dir ( & path) . await ?;
422
+ let mut dates = ReadDirStream :: new ( directories) ;
423
+ while let Some ( date) = dates. next ( ) . await {
424
+ let date = date?;
425
+ if !date. path ( ) . is_dir ( ) {
426
+ continue ;
428
427
}
428
+ let date = NaiveDate :: parse_from_str (
429
+ date. file_name ( )
430
+ . to_string_lossy ( )
431
+ . trim_start_matches ( "date=" ) ,
432
+ "%Y-%m-%d" ,
433
+ )
434
+ . unwrap ( ) ;
435
+ date_list. push ( date) ;
429
436
}
430
437
date_list. sort ( ) ;
438
+
431
439
Ok ( date_list)
432
440
}
433
441
You can’t perform that action at this time.
0 commit comments