@@ -60,13 +60,9 @@ impl Default for OrphanSweeperConfig {
6060 }
6161}
6262
63- /// Adaptive batching policy configuration.
63+ /// Policy-driven batching configuration.
6464#[ derive( Clone , Debug , clap:: Args ) ]
6565pub struct BatchPolicyConfig {
66- /// Enable adaptive policy-driven batch dispatch.
67- #[ arg( long, env = "BATCH_POLICY_ENABLED" , default_value = "false" ) ]
68- pub enabled : bool ,
69-
7066 /// Re-evaluation cadence for policy decisions, in milliseconds.
7167 #[ arg( long, env = "BATCH_REEVAL_MS" , default_value = "1000" ) ]
7268 pub reeval_ms : u64 ,
@@ -91,7 +87,6 @@ pub struct BatchPolicyConfig {
9187impl Default for BatchPolicyConfig {
9288 fn default ( ) -> Self {
9389 Self {
94- enabled : false ,
9590 reeval_ms : 1_000 ,
9691 max_wait_secs : 30 ,
9792 cost_ema_alpha : 0.2 ,
@@ -229,12 +224,9 @@ impl GatewayConfig {
229224 ) ) ;
230225 }
231226
232- if self . batch_policy . enabled
233- && self . sweeper ( ) . stale_queued_threshold_secs <= self . batch_policy . max_wait_secs
234- {
227+ if self . sweeper ( ) . stale_queued_threshold_secs <= self . batch_policy . max_wait_secs {
235228 return Err ( GatewayError :: Config (
236- "STALE_QUEUED_THRESHOLD_SECS must be greater than BATCH_MAX_WAIT_SECS when adaptive batching is enabled"
237- . to_string ( ) ,
229+ "STALE_QUEUED_THRESHOLD_SECS must be greater than BATCH_MAX_WAIT_SECS" . to_string ( ) ,
238230 ) ) ;
239231 }
240232
@@ -376,4 +368,16 @@ mod tests {
376368 assert ! ( err. contains( "BATCH_COST_HIGH_RATIO" ) ) ;
377369 assert ! ( err. contains( "finite" ) ) ;
378370 }
371+
372+ #[ test]
373+ fn test_stale_queued_threshold_must_exceed_max_wait_secs ( ) {
374+ let mut config = parse_valid_config ( ) ;
375+ config. batch_policy . max_wait_secs = 30 ;
376+ config. stale_queued_threshold_secs = 30 ;
377+
378+ let result = config. validate ( ) ;
379+ assert ! ( result. is_err( ) ) ;
380+ let err = result. unwrap_err ( ) . to_string ( ) ;
381+ assert ! ( err. contains( "STALE_QUEUED_THRESHOLD_SECS" ) ) ;
382+ }
379383}
0 commit comments