From 9abb7c21639ab4fd63f519bccadb9f711f6d447e Mon Sep 17 00:00:00 2001 From: AJ Stuyvenberg Date: Mon, 10 Mar 2025 08:34:37 -0400 Subject: [PATCH 1/2] fix: max duration 15 minutes --- bottlecap/src/lifecycle/flush_control.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bottlecap/src/lifecycle/flush_control.rs b/bottlecap/src/lifecycle/flush_control.rs index 84673c5a9..ac4457704 100644 --- a/bottlecap/src/lifecycle/flush_control.rs +++ b/bottlecap/src/lifecycle/flush_control.rs @@ -7,6 +7,7 @@ use crate::lifecycle::invocation_times::InvocationTimes; const DEFAULT_FLUSH_INTERVAL: u64 = 60 * 1000; // 60s const TWENTY_SECONDS: u64 = 20 * 1000; +const FIFTEEN_MINUTES: u64 = 15 * 60 * 1000; #[derive(Clone, Copy, Debug, PartialEq)] pub struct FlushControl { @@ -63,7 +64,7 @@ impl FlushControl { FlushStrategy::Periodically(p) | FlushStrategy::EndPeriodically(p) => { tokio::time::interval(tokio::time::Duration::from_millis(p.interval)) } - FlushStrategy::End => tokio::time::interval(tokio::time::Duration::MAX), + FlushStrategy::End => tokio::time::interval(tokio::time::Duration::from_millis(FIFTEEN_MINUTES)), } } @@ -165,7 +166,7 @@ mod tests { let flush_control = FlushControl::new(FlushStrategy::End); assert_eq!( flush_control.get_flush_interval().period().as_millis(), - tokio::time::Duration::MAX.as_millis() + tokio::time::Duration::from_millis(FIFTEEN_MINUTES).as_millis() ); } } From 2ab2f9cddefce7750a20f68e23c47a26cb4af20d Mon Sep 17 00:00:00 2001 From: AJ Stuyvenberg Date: Mon, 10 Mar 2025 09:00:21 -0400 Subject: [PATCH 2/2] fix: fmt --- bottlecap/src/lifecycle/flush_control.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bottlecap/src/lifecycle/flush_control.rs b/bottlecap/src/lifecycle/flush_control.rs index ac4457704..90dad1a7a 100644 --- a/bottlecap/src/lifecycle/flush_control.rs +++ b/bottlecap/src/lifecycle/flush_control.rs @@ -64,7 +64,9 @@ impl FlushControl { FlushStrategy::Periodically(p) | FlushStrategy::EndPeriodically(p) => { tokio::time::interval(tokio::time::Duration::from_millis(p.interval)) } - FlushStrategy::End => tokio::time::interval(tokio::time::Duration::from_millis(FIFTEEN_MINUTES)), + FlushStrategy::End => { + tokio::time::interval(tokio::time::Duration::from_millis(FIFTEEN_MINUTES)) + } } }