fix memory usage redis

This commit is contained in:
Mateusz Gruszczyński
2026-08-16 22:43:06 +02:00
parent 40474cdc59
commit 074d17be89
22 changed files with 1377 additions and 382 deletions
+17 -1
View File
@@ -18,7 +18,7 @@ def test_redis_uses_aof_everysec_and_rdb_snapshot():
assert cmd[cmd.index("--appendfsync") + 1] == "everysec"
assert cmd[cmd.index("--save") + 1:cmd.index("--save") + 3] == ["900", "100"]
assert cmd[cmd.index("--dir") + 1] == td
assert cmd[cmd.index("--maxmemory") + 1] == "0"
assert cmd[cmd.index("--maxmemory") + 1] == "128mb"
assert cmd[cmd.index("--maxmemory-policy") + 1] == "noeviction"
@@ -32,3 +32,19 @@ def test_redis_status_exposes_runtime_details_for_system_ui():
assert status["data_dir"] == td
assert status["snapshot_seconds"] == 1200
assert status["persistence"] == "AOF everysec + RDB"
def test_redis_defaults_to_bounded_transient_buffer():
with tempfile.TemporaryDirectory() as td:
supervisor = RedisSupervisor(True, td, port=6382)
supervisor.executable = "/usr/bin/redis-server"
with patch("app.redis_service.subprocess.Popen") as popen:
process = popen.return_value
process.poll.return_value = None
process.pid = 124
supervisor._spawn()
cmd = popen.call_args.args[0]
assert cmd[cmd.index("--appendonly") + 1] == "no"
assert cmd[cmd.index("--save") + 1] == ""
assert cmd[cmd.index("--maxmemory") + 1] == "128mb"
assert supervisor.status()["persistence"] == "disabled (SQLite archive is durable)"