[router] add worker abstraction (#7960)

This commit is contained in:
Simo Lin
2025-07-11 20:17:48 -07:00
committed by GitHub
parent 2a2d3478af
commit f2d5c4920e
11 changed files with 960 additions and 410 deletions

View File

@@ -547,11 +547,12 @@ mod tests {
// Helper to create a Router instance for testing event handlers
fn create_test_router() -> Arc<Router> {
let worker_urls = Arc::new(RwLock::new(Vec::new()));
let workers = Arc::new(RwLock::new(Vec::new()));
Arc::new(Router::Random {
worker_urls,
workers,
timeout_secs: 5,
interval_secs: 1,
_health_checker: None,
})
}
@@ -878,8 +879,6 @@ mod tests {
assert!(!tracked_pods.lock().unwrap().contains(&pod_info));
assert!(!router
.get_worker_urls()
.read()
.unwrap()
.contains(&pod_info.worker_url(port)));
}
@@ -907,7 +906,7 @@ mod tests {
.await;
assert!(tracked_pods.lock().unwrap().is_empty());
assert!(router.get_worker_urls().read().unwrap().is_empty());
assert!(router.get_worker_urls().is_empty());
}
#[tokio::test]