From 80ac26c55f4b3f0e5d0e2ff87db07257042d09b5 Mon Sep 17 00:00:00 2001 From: lym953 <10097700+lym953@users.noreply.github.com> Date: Thu, 19 Nov 2026 16:56:34 -0500 Subject: [PATCH] [SVLS-10207] fix(flush): raise the end strategy timer to the 30-minute Lambda timeout AWS raised the maximum timeout of on-demand Lambda functions to 30 minutes. The end flush strategy sets a timer to the maximum timeout so that it never fires. With a 15-minute timer, an invocation longer than 15 minutes got a blocking flush while the handler ran. Co-Authored-By: Claude Opus 5.5 --- bottlecap/README.md | 2 +- bottlecap/src/bin/bottlecap-test-mode/main.rs | 2 +- bottlecap/src/lifecycle/flush_control.rs | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bottlecap/README.md b/bottlecap/README.md index 60a9db35e..79620b376 100644 --- a/bottlecap/README.md +++ b/bottlecap/README.md @@ -52,7 +52,7 @@ Lambda Managed Instances run your functions on EC2 instances (managed by AWS) wi #### `End` - **Configuration**: `DD_SERVERLESS_FLUSH_STRATEGY=end` - **Behavior**: Always flushes at the end of each invocation (blocking) -- **Interval**: 15 minutes (effectively disables periodic flushing) +- **Interval**: 30 minutes, the maximum on-demand Lambda timeout (effectively disables periodic flushing) - **Use case**: Minimize flushing overhead - only flush once per invocation when the invocation is complete #### `EndPeriodically` diff --git a/bottlecap/src/bin/bottlecap-test-mode/main.rs b/bottlecap/src/bin/bottlecap-test-mode/main.rs index 0960c9fee..e63c83ccc 100644 --- a/bottlecap/src/bin/bottlecap-test-mode/main.rs +++ b/bottlecap/src/bin/bottlecap-test-mode/main.rs @@ -278,7 +278,7 @@ async fn shutdown_signal() -> anyhow::Result<()> { /// Spawns the periodic flush driver. Decoupled from managed-instance mode: any /// non-Default strategy enables it, using that strategy's interval. Note that -/// `end` yields the 15-minute placeholder interval `FlushControl` uses to mean +/// `end` yields the 30-minute placeholder interval `FlushControl` uses to mean /// "never race a flush", so it is periodic only in name. Manual flushing via /// `POST /flush` always works regardless. fn spawn_periodic_flush( diff --git a/bottlecap/src/lifecycle/flush_control.rs b/bottlecap/src/lifecycle/flush_control.rs index 9ddb0e40d..b872053e8 100644 --- a/bottlecap/src/lifecycle/flush_control.rs +++ b/bottlecap/src/lifecycle/flush_control.rs @@ -6,7 +6,7 @@ use crate::lifecycle::invocation_times::InvocationTimes; const DEFAULT_FLUSH_INTERVAL: u64 = 60 * 1000; // 60s pub const DEFAULT_CONTINUOUS_FLUSH_INTERVAL: u64 = 30 * 1000; // 30s -const FIFTEEN_MINUTES: u64 = 15 * 60 * 1000; +const THIRTY_MINUTES: u64 = 30 * 60 * 1000; #[derive(Clone, Copy, Debug, PartialEq)] pub struct FlushControl { @@ -58,9 +58,9 @@ impl FlushControl { i } FlushStrategy::End => { - // Set the race flush interval to the maximum value of Lambda timeout, so flush will - // only happen at the end of the invocation, and race flush will never happen. - tokio::time::interval(tokio::time::Duration::from_millis(FIFTEEN_MINUTES)) + // Set the race flush interval to the maximum Lambda timeout in on-demand mode, the + // only mode that uses `End`, so flush will only happen at the end of the invocation. + tokio::time::interval(tokio::time::Duration::from_millis(THIRTY_MINUTES)) } } } @@ -208,7 +208,7 @@ mod tests { let flush_control = FlushControl::new(FlushStrategy::End, 60); assert_eq!( flush_control.get_flush_interval().period().as_millis(), - tokio::time::Duration::from_millis(FIFTEEN_MINUTES).as_millis() + tokio::time::Duration::from_millis(THIRTY_MINUTES).as_millis() ); } }