[router] Add builder pattern for RouterConfig with zero duplication (#12030)

This commit is contained in:
Simo Lin
2025-10-23 16:46:10 -07:00
committed by GitHub
parent 2c057fbfa8
commit 6d6e24bcc4
12 changed files with 1081 additions and 943 deletions

View File

@@ -19,16 +19,12 @@ struct TestContext {
impl TestContext {
async fn new(worker_configs: Vec<MockWorkerConfig>) -> Self {
let mut config = RouterConfig {
chat_template: None,
mode: RoutingMode::Regular {
worker_urls: vec![],
},
port: 3003,
worker_startup_timeout_secs: 1,
worker_startup_check_interval_secs: 1,
..Default::default()
};
let mut config = RouterConfig::builder()
.regular_mode(vec![])
.port(3003)
.worker_startup_timeout_secs(1)
.worker_startup_check_interval_secs(1)
.build_unchecked();
let mut workers = Vec::new();
let mut worker_urls = Vec::new();