chore: disable stats persistence by default (#6900)

* chore: disable stats persistence by default

Signed-off-by: WenyXu <wenymedia@gmail.com>

* chore: apply suggestions

Signed-off-by: WenyXu <wenymedia@gmail.com>

* chore: apply suggestions

Signed-off-by: WenyXu <wenymedia@gmail.com>

* fix: fix clippy

Signed-off-by: WenyXu <wenymedia@gmail.com>

---------

Signed-off-by: WenyXu <wenymedia@gmail.com>
This commit is contained in:
Weny Xu
2025-09-03 20:39:43 +08:00
parent 9c1240921d
commit 8bf772fb50
5 changed files with 16 additions and 16 deletions

View File

@@ -152,13 +152,9 @@ fn align_ts(ts: i64, interval: Duration) -> i64 {
impl PersistStatsHandler {
/// Creates a new [`PersistStatsHandler`].
pub fn new(inserter: Box<dyn Inserter>, mut persist_interval: Duration) -> Self {
if persist_interval < Duration::from_secs(60) {
warn!("persist_interval is less than 60 seconds, set to 60 seconds");
persist_interval = Duration::from_secs(60);
}
if persist_interval.as_millis() == 0 {
warn!("persist_interval as milliseconds is zero, set to 60 second");
persist_interval = Duration::from_secs(60);
if persist_interval < Duration::from_mins(10) {
warn!("persist_interval is less than 10 minutes, set to 10 minutes");
persist_interval = Duration::from_mins(10);
}
Self {

View File

@@ -16,6 +16,7 @@
#![feature(assert_matches)]
#![feature(hash_set_entry)]
#![feature(let_chains)]
#![feature(duration_constructors_lite)]
#![feature(duration_constructors)]
pub mod bootstrap;

View File

@@ -114,8 +114,8 @@ pub struct StatsPersistenceOptions {
impl Default for StatsPersistenceOptions {
fn default() -> Self {
Self {
ttl: Duration::from_days(30),
interval: Duration::from_secs(60),
ttl: Duration::ZERO,
interval: Duration::from_mins(10),
}
}
}