mirror of
https://github.com/Comfy-Org/ComfyUI.git
synced 2026-09-21 13:38:08 -05:00
Clamp system metrics to safe integers
This commit is contained in:
@@ -20,7 +20,7 @@ MAX_VOLUMES = 64
|
||||
MAX_ACCELERATORS = 64
|
||||
MAX_LABEL_LENGTH = 128
|
||||
MAX_NAME_LENGTH = 256
|
||||
MAX_BYTES = 2**63 - 1
|
||||
MAX_BYTES = 2**53 - 1
|
||||
|
||||
_cache_lock = threading.Lock()
|
||||
_cached_at = -math.inf
|
||||
|
||||
@@ -134,3 +134,8 @@ def test_missing_optional_sensors_are_null():
|
||||
assert accelerator["name"] == "Fallback GPU"
|
||||
assert accelerator["utilization_percent"] is None
|
||||
assert accelerator["temperature_c"] is None
|
||||
|
||||
|
||||
def test_byte_totals_fit_the_cross_language_safe_integer_contract():
|
||||
assert system_monitor._bytes(2**63) == 2**53 - 1
|
||||
assert system_monitor._bytes(-1) == 0
|
||||
|
||||
Reference in New Issue
Block a user