Fix cache-aware router should pick min load instead of min tenant size (#14650)

This commit is contained in:
fzyzcjy
2025-12-09 05:33:34 +08:00
committed by GitHub
parent 32f8b6064e
commit 2e3946d889

View File

@@ -311,7 +311,10 @@ impl LoadBalancingPolicy for CacheAwarePolicy {
matched_worker.to_string()
} else {
RouterMetrics::record_cache_miss();
tree.get_smallest_tenant()
let min_load_idx = *healthy_indices
.iter()
.min_by_key(|&&idx| workers[idx].load())?;
workers[min_load_idx].url().to_string()
};
// Find the index of the selected worker