Switch swap threshold default to absolute 3048 MB and disable percent threshold by default

This commit is contained in:
Andrew Emelyaneko
2026-10-31 20:14:18 +03:00
parent 8cccc2612d
commit bdf7b9686d
6 changed files with 30 additions and 6 deletions
+1
View File
@@ -20,6 +20,7 @@ def make_config(tmp_path):
"state_file": str(tmp_path / "state.json"),
"launch_agent_plist": str(tmp_path / "com.ollama.serve.plist"),
"poll_interval_seconds": 60,
"swap_threshold_mb": 30,
}
)
+8 -1
View File
@@ -67,4 +67,11 @@ def test_count_recent():
def test_load_config_missing_file(tmp_path):
config = c.load_config(str(tmp_path / "config.json"))
assert config["port"] == 8731
assert config["swap_threshold_percent"] == 25
assert config["swap_threshold_percent"] is None
assert config["swap_threshold_mb"] == 3048.0
def test_threshold_absolute_default():
config = c.merge_config({})
assert c.threshold_exceeded(config, c.SwapStats(2048, 596.38, 1451.62)) is False
assert c.threshold_exceeded(config, c.SwapStats(2048, 3048, 0)) is True