Skip to content

Commit 511cf45

Browse files
authored
fix: max duration 15 minutes (#599)
* fix: max duration 15 minutes * fix: fmt
1 parent a15e420 commit 511cf45

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bottlecap/src/lifecycle/flush_control.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::lifecycle::invocation_times::InvocationTimes;
77

88
const DEFAULT_FLUSH_INTERVAL: u64 = 60 * 1000; // 60s
99
const TWENTY_SECONDS: u64 = 20 * 1000;
10+
const FIFTEEN_MINUTES: u64 = 15 * 60 * 1000;
1011

1112
#[derive(Clone, Copy, Debug, PartialEq)]
1213
pub struct FlushControl {
@@ -63,7 +64,9 @@ impl FlushControl {
6364
FlushStrategy::Periodically(p) | FlushStrategy::EndPeriodically(p) => {
6465
tokio::time::interval(tokio::time::Duration::from_millis(p.interval))
6566
}
66-
FlushStrategy::End => tokio::time::interval(tokio::time::Duration::MAX),
67+
FlushStrategy::End => {
68+
tokio::time::interval(tokio::time::Duration::from_millis(FIFTEEN_MINUTES))
69+
}
6770
}
6871
}
6972

@@ -165,7 +168,7 @@ mod tests {
165168
let flush_control = FlushControl::new(FlushStrategy::End);
166169
assert_eq!(
167170
flush_control.get_flush_interval().period().as_millis(),
168-
tokio::time::Duration::MAX.as_millis()
171+
tokio::time::Duration::from_millis(FIFTEEN_MINUTES).as_millis()
169172
);
170173
}
171174
}

0 commit comments

Comments
 (0)