Skip to content

Commit 1eccd4b

Browse files
committed
fix: make health ping initialize pool
1 parent 8b1dda3 commit 1eccd4b

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/utils/postgres_db_manager.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ def ping(self) -> dict:
4444
import time
4545
start = time.monotonic()
4646
try:
47+
# The pooled connection is opened lazily; health probes must be able
48+
# to establish it before asking for a connection.
49+
self._open_pool()
4750
with self._connect() as conn:
4851
conn.execute("SELECT 1")
4952
return {"ok": True, "latency_ms": round((time.monotonic() - start) * 1000, 2)}

tests/test_pool_store_redis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _make_manager(monkeypatch, budget_mb, redis_url):
2828
m = jsm.JoernServerManager(config=load_config(), redis_url=redis_url)
2929
# Stub the Docker-/network-touching bits so we exercise only coordination.
3030
m._wait_for_server = lambda port, timeout=120, codebase_hash="": True
31-
m._port_healthy = lambda port: True
31+
m._port_healthy = lambda port, codebase_hash="": True
3232
m._plan_server = lambda h: (2, 3072) # tier-S: 3072 MB reservation each
3333
return m, fake
3434

0 commit comments

Comments
 (0)