mirror of
https://github.com/gyptazy/ProxLB.git
synced 2026-04-05 20:31:57 +02:00
Merge pull request #198 from glitchvern/fix/197-remove-hard-coded-memory-usage-from-lowest-usage-node
fix: Use method/mode in configuration to calculate lowest_usage_node
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
fixed:
|
||||
- Remove hard coded memory usage from lowest usage node and use method and mode specified in configuration instead (by @glitchvern) [#197]
|
||||
@@ -147,7 +147,9 @@ class Calculations:
|
||||
|
||||
# Do not include nodes that are marked in 'maintenance'
|
||||
filtered_nodes = [node for node in proxlb_data["nodes"].values() if not node["maintenance"]]
|
||||
lowest_usage_node = min(filtered_nodes, key=lambda x: x["memory_used_percent"])
|
||||
method = proxlb_data["meta"]["balancing"].get("method", "memory")
|
||||
mode = proxlb_data["meta"]["balancing"].get("mode", "used")
|
||||
lowest_usage_node = min(filtered_nodes, key=lambda x: x[f"{method}_{mode}_percent"])
|
||||
proxlb_data["meta"]["balancing"]["balance_reason"] = 'resources'
|
||||
proxlb_data["meta"]["balancing"]["balance_next_node"] = lowest_usage_node["name"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user