fix(infra): single-read file_read (no double disk I/O for hash) + bail health poll on dead process

This commit is contained in:
2026-07-12 12:55:12 +04:00
parent 363d880a69
commit b93729008d
2 changed files with 10 additions and 5 deletions
@@ -151,10 +151,12 @@ class DefaultModelManager(
currentDescriptor = null
}
@Suppress("UnusedParameter")
private suspend fun waitForHealthy(process: LlamaProcess): Boolean {
val endTime = Clock.System.now().toEpochMilliseconds() + healthTimeoutMs
while (Clock.System.now().toEpochMilliseconds() < endTime) {
// A crashed process (bad --model, port clash) never gets healthy; polling the full
// timeout is pure dead time. Bail as soon as it's gone.
if (!process.isAlive) return false
try {
val response = httpClient.get("http://$host:$port/health").body<String>()
if (response.contains("\"status\":\"healthy\"") || response.contains("ok")) {