Skip to content

Commit bcc7ab1

Browse files
fix: limitless router weight rounding error (#988)
1 parent a3a07b8 commit bcc7ab1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

aws_advanced_python_wrapper/limitless_plugin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from __future__ import annotations
1313

1414
import copy
15+
import math
1516
import time
1617
from contextlib import closing
1718
from threading import Event, RLock, Thread
@@ -248,7 +249,7 @@ def _create_host_info(self, result: Tuple[Any, Any], host_port_to_map: int) -> H
248249
host_name: str = result[0]
249250
cpu: float = float(result[1])
250251

251-
weight: int = round(10 - (cpu * 10))
252+
weight: int = 10 - math.floor(cpu * 10)
252253
if weight < 1 or weight > 10:
253254
weight = 1
254255
logger.debug("LimitlessRouterMonitor.InvalidRouterLoad", host_name, cpu)

0 commit comments

Comments
 (0)