Skip to content

Commit 2cb55bb

Browse files
authored
fix: reset stream stats with limit (openobserve#6995)
1 parent 3c5ae41 commit 2cb55bb

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

src/cli/basic/cli.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -327,20 +327,9 @@ pub async fn cli() -> Result<bool, anyhow::Error> {
327327
// load stream list
328328
db::schema::cache().await?;
329329
// 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");
344333
}
345334
_ => {
346335
return Err(anyhow::anyhow!(

src/service/compact/stats.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,20 @@ use crate::{
2323
};
2424

2525
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> {
2640
// get last offset
2741
let (mut offset, node) = db::compact::stats::get_offset().await;
2842
if !node.is_empty() && LOCAL_NODE.uuid.ne(&node) && get_node_by_uuid(&node).await.is_some() {

0 commit comments

Comments
 (0)