Fix wait_ready crashing after sd-server binds port during model load

Only ConnectError was caught, so once the port opened but the model
was still loading, health check timeouts (ReadTimeout) and connection
resets (ReadError) would crash the polling loop instead of retrying.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Adam Ladachowski
2026-02-12 22:05:51 +00:00
parent bb25c7ce94
commit ba8d176340
+4 -2
View File
@@ -29,7 +29,7 @@ class ProcessManager:
def build_cmd(self) -> list[str]:
if self.config is None:
raise RuntimeError("No config set")
cmd = [SD_SERVER_BIN, "-m", self.config.model, "--port", str(self.config.port)]
cmd = [SD_SERVER_BIN, "-m", self.config.model, "--listen-port", str(self.config.port)]
cmd.extend(self.config.args)
return cmd
@@ -65,6 +65,8 @@ class ProcessManager:
"running": True,
"pid": self.proc.pid,
"model": self.config.model if self.config else None,
"port": self.config.port if self.config else None,
"bind": f"http://127.0.0.1:{self.config.port}" if self.config else None,
"cmd": self.build_cmd(),
}
@@ -82,7 +84,7 @@ class ProcessManager:
r = await client.get(url, timeout=2)
if r.status_code == _HTTP_OK:
return True
except httpx.ConnectError:
except (httpx.ConnectError, httpx.TimeoutException, httpx.ReadError):
pass
await asyncio.sleep(1)
return False