File tree Expand file tree Collapse file tree 2 files changed +17
-14
lines changed Expand file tree Collapse file tree 2 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -327,20 +327,9 @@ pub async fn cli() -> Result<bool, anyhow::Error> {
327
327
// load stream list
328
328
db:: schema:: cache ( ) . await ?;
329
329
// update stats from file list
330
- loop {
331
- let ret = compact:: stats:: update_stats_from_file_list ( )
332
- . await
333
- . expect ( "file list remote calculate stats failed" ) ;
334
- let Some ( offset) = ret else {
335
- break ;
336
- } ;
337
- log:: info!(
338
- "keep updating stats from file list, offset: {:?} ..." ,
339
- offset
340
- ) ;
341
- tokio:: time:: sleep ( tokio:: time:: Duration :: from_millis ( 50 ) ) . await ;
342
- }
343
- log:: info!( "update stats from file list success" ) ;
330
+ compact:: stats:: update_stats_from_file_list ( )
331
+ . await
332
+ . expect ( "file list remote calculate stats failed" ) ;
344
333
}
345
334
_ => {
346
335
return Err ( anyhow:: anyhow!(
Original file line number Diff line number Diff line change @@ -23,6 +23,20 @@ use crate::{
23
23
} ;
24
24
25
25
pub async fn update_stats_from_file_list ( ) -> Result < Option < ( i64 , i64 ) > , anyhow:: Error > {
26
+ loop {
27
+ let Some ( offset) = update_stats_from_file_list_inner ( ) . await ? else {
28
+ break ;
29
+ } ;
30
+ log:: info!(
31
+ "keep updating stream stats from file list, offset: {:?} ..." ,
32
+ offset
33
+ ) ;
34
+ tokio:: time:: sleep ( tokio:: time:: Duration :: from_millis ( 50 ) ) . await ;
35
+ }
36
+ Ok ( None )
37
+ }
38
+
39
+ async fn update_stats_from_file_list_inner ( ) -> Result < Option < ( i64 , i64 ) > , anyhow:: Error > {
26
40
// get last offset
27
41
let ( mut offset, node) = db:: compact:: stats:: get_offset ( ) . await ;
28
42
if !node. is_empty ( ) && LOCAL_NODE . uuid . ne ( & node) && get_node_by_uuid ( & node) . await . is_some ( ) {
You can’t perform that action at this time.
0 commit comments