clusters update

This commit is contained in:
Vladless
2024-11-19 19:31:31 +03:00
parent 8bfdc6e319
commit 6fc26754bf
+4 -1
View File
@@ -72,7 +72,10 @@ async def get_least_loaded_cluster() -> str:
logger.warning("No valid clusters found in config, returning 'cluster1'.")
return "cluster1"
least_loaded_cluster = min(cluster_loads, key=cluster_loads.get)
least_loaded_cluster = min(
cluster_loads, key=lambda k: (cluster_loads.get(k, 0), k)
)
logger.info(f"Least loaded cluster selected: {least_loaded_cluster}")
return least_loaded_cluster