fix(lease-broker): recovery_runtime_unittest wait_ready() connect-probe (co-equal CI flake, cherry-pick #898) #900

Merged
Mos merged 1 commits from fix/recovery-runtime-wait-ready-race into main 2026-07-25 22:26:38 +00:00

View File

@@ -62,8 +62,13 @@ def request(socket_path: Path, value: dict[str, object]) -> dict[str, object]:
def wait_ready(process: subprocess.Popen[str], socket_path: Path) -> None:
deadline = time.monotonic() + 5.0
while time.monotonic() < deadline:
if socket_path.exists():
try:
with socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) as probe:
probe.settimeout(0.25)
probe.connect(str(socket_path))
return
except (ConnectionRefusedError, FileNotFoundError):
pass
if process.poll() is not None:
output = process.stdout.read() if process.stdout is not None else ""
raise RuntimeError(f"daemon exited before READY: {output}")