@@ -39,6 +39,8 @@ pub struct RouterConfig {
39
39
pub max_concurrent_requests : usize ,
40
40
/// CORS allowed origins
41
41
pub cors_allowed_origins : Vec < String > ,
42
+ /// Retry configuration
43
+ pub retry : RetryConfig ,
42
44
}
43
45
44
46
/// Routing mode configuration
@@ -182,6 +184,30 @@ impl Default for DiscoveryConfig {
182
184
}
183
185
}
184
186
187
+ /// Retry configuration for request handling
188
+ #[ derive( Debug , Clone , Serialize , Deserialize ) ]
189
+ pub struct RetryConfig {
190
+ /// Maximum number of retry attempts
191
+ pub max_retries : u32 ,
192
+ /// Initial backoff delay in milliseconds
193
+ pub initial_backoff_ms : u64 ,
194
+ /// Maximum backoff delay in milliseconds
195
+ pub max_backoff_ms : u64 ,
196
+ /// Backoff multiplier for exponential backoff
197
+ pub backoff_multiplier : f32 ,
198
+ }
199
+
200
+ impl Default for RetryConfig {
201
+ fn default ( ) -> Self {
202
+ Self {
203
+ max_retries : 3 ,
204
+ initial_backoff_ms : 100 ,
205
+ max_backoff_ms : 10000 ,
206
+ backoff_multiplier : 2.0 ,
207
+ }
208
+ }
209
+ }
210
+
185
211
/// Metrics configuration
186
212
#[ derive( Debug , Clone , Serialize , Deserialize ) ]
187
213
pub struct MetricsConfig {
@@ -210,7 +236,7 @@ impl Default for RouterConfig {
210
236
host : "127.0.0.1" . to_string ( ) ,
211
237
port : 3001 ,
212
238
max_payload_size : 268_435_456 , // 256MB
213
- request_timeout_secs : 600 ,
239
+ request_timeout_secs : 3600 , // 1 hour to match Python mini LB
214
240
worker_startup_timeout_secs : 300 ,
215
241
worker_startup_check_interval_secs : 10 ,
216
242
dp_aware : false ,
@@ -222,6 +248,7 @@ impl Default for RouterConfig {
222
248
request_id_headers : None ,
223
249
max_concurrent_requests : 64 ,
224
250
cors_allowed_origins : vec ! [ ] ,
251
+ retry : RetryConfig :: default ( ) ,
225
252
}
226
253
}
227
254
}
@@ -277,7 +304,7 @@ mod tests {
277
304
assert_eq ! ( config. host, "127.0.0.1" ) ;
278
305
assert_eq ! ( config. port, 3001 ) ;
279
306
assert_eq ! ( config. max_payload_size, 268_435_456 ) ;
280
- assert_eq ! ( config. request_timeout_secs, 600 ) ;
307
+ assert_eq ! ( config. request_timeout_secs, 3600 ) ;
281
308
assert_eq ! ( config. worker_startup_timeout_secs, 300 ) ;
282
309
assert_eq ! ( config. worker_startup_check_interval_secs, 10 ) ;
283
310
assert ! ( config. discovery. is_none( ) ) ;
@@ -332,6 +359,7 @@ mod tests {
332
359
request_id_headers : None ,
333
360
max_concurrent_requests : 64 ,
334
361
cors_allowed_origins : vec ! [ ] ,
362
+ retry : RetryConfig :: default ( ) ,
335
363
} ;
336
364
337
365
let json = serde_json:: to_string ( & config) . unwrap ( ) ;
@@ -759,6 +787,7 @@ mod tests {
759
787
request_id_headers : None ,
760
788
max_concurrent_requests : 64 ,
761
789
cors_allowed_origins : vec ! [ ] ,
790
+ retry : RetryConfig :: default ( ) ,
762
791
} ;
763
792
764
793
assert ! ( config. mode. is_pd_mode( ) ) ;
@@ -810,6 +839,7 @@ mod tests {
810
839
request_id_headers : None ,
811
840
max_concurrent_requests : 64 ,
812
841
cors_allowed_origins : vec ! [ ] ,
842
+ retry : RetryConfig :: default ( ) ,
813
843
} ;
814
844
815
845
assert ! ( !config. mode. is_pd_mode( ) ) ;
@@ -857,6 +887,7 @@ mod tests {
857
887
request_id_headers : None ,
858
888
max_concurrent_requests : 64 ,
859
889
cors_allowed_origins : vec ! [ ] ,
890
+ retry : RetryConfig :: default ( ) ,
860
891
} ;
861
892
862
893
assert ! ( config. has_service_discovery( ) ) ;
0 commit comments