Skip to content

Commit

Permalink
Make service alive checking more universal
Browse files Browse the repository at this point in the history
  • Loading branch information
phoebusm committed Jun 11, 2024
1 parent 911a55c commit 66900fc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion python/arcticdb/storage_fixtures/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ def terminate(p: Union[multiprocessing.Process, subprocess.Popen]):

def wait_for_server_to_come_up(url: str, service: str, process: ProcessUnion, *, timeout=20, sleep=0.2, req_timeout=1):
deadline = time.time() + timeout
alive = (lambda: process.poll() is None) if isinstance(process, subprocess.Popen) else process.is_alive
if process is None:
alive = lambda: True
else:
alive = (lambda: process.poll() is None) if isinstance(process, subprocess.Popen) else process.is_alive
while True:
assert time.time() < deadline, f"Timed out waiting for {service} process to start"
assert alive(), service + " process died shortly after start up"
Expand Down

0 comments on commit 66900fc

Please sign in to comment.