-
Notifications
You must be signed in to change notification settings - Fork 9
fix: Split timeouts #833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Split timeouts #833
Changes from all commits
b33c77d
d33ec18
3c9069d
4c5cd92
5144ff4
2286053
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1054,7 +1054,7 @@ pub struct DaemonConfig { | |
| pub max_backoff_ms: u64, | ||
|
|
||
| /// Deprecated: use first_chunk_timeout_ms, chunk_timeout_ms, and body_timeout_ms instead. | ||
| /// If set, applies the same value uniformly to all three granular timeouts. | ||
| /// If set, splits into 90% first_chunk_timeout_ms and 10% body_timeout_ms. | ||
| /// Ignored when the granular timeout fields are explicitly set. | ||
| pub timeout_ms: Option<u64>, | ||
|
|
||
|
|
@@ -1173,18 +1173,15 @@ impl DaemonConfig { | |
| model_capacity_limits: Option<std::sync::Arc<dashmap::DashMap<String, usize>>>, | ||
| ) -> fusillade::daemon::DaemonConfig { | ||
| // If the deprecated timeout_ms is set and the granular fields are at their | ||
| // defaults, apply it uniformly to all three granular timeouts. This is | ||
| // conservative: existing deployments using e.g. timeout_ms=600000 keep | ||
| // the same 10-minute budget for every phase instead of getting a | ||
| // surprising 60-second body_timeout_ms from a 90/10 split. | ||
| // defaults, split it: 90% header (connect + TTFT), 10% body. | ||
| let (first_chunk_timeout_ms, chunk_timeout_ms, body_timeout_ms) = if let Some(timeout) = self.timeout_ms { | ||
| if self.first_chunk_timeout_ms == 86_400_000 && self.chunk_timeout_ms == 86_400_000 && self.body_timeout_ms == 86_400_000 { | ||
| tracing::warn!( | ||
| timeout_ms = timeout, | ||
| "batch_daemon.timeout_ms is deprecated; \ | ||
| use first_chunk_timeout_ms, chunk_timeout_ms, and body_timeout_ms instead" | ||
| ); | ||
| (timeout, timeout, timeout) | ||
| (timeout * 9 / 10, 86_400_000, timeout / 10) | ||
|
Comment on lines
1178
to
+1184
|
||
| } else { | ||
| // Granular fields were explicitly set — ignore deprecated field | ||
| (self.first_chunk_timeout_ms, self.chunk_timeout_ms, self.body_timeout_ms) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timeout * 9 / 10can overflowu64(wrap in release / panic in debug), producing incorrect timeouts. Consider usingchecked_mul/saturating_mul(or an order of operations that can’t overflow) and also ensure the 90/10 split can’t yield a 0ms timeout for smalltimeout_msvalues (e.g., clamp to at least 1ms).