fix(core): reduce ollama startup blocking and handle cold starts gracefully

The ensure_ollama() function previously blocked for up to 10 seconds
waiting for Ollama to become reachable after spawning. Cold starts can
take 30-60s, so this often timed out and reported a misleading error.

Now waits only 5 seconds (enough for hot restarts), and if Ollama is
still starting, reports started=true with no error instead of treating
it as a failure. The embed stage runs 60-90s later (after ingestion),
by which time Ollama is ready. The handler log message is updated to
distinguish hot restarts from cold starts still in progress.
This commit is contained in:
teernisse
2026-03-13 08:58:18 -04:00
parent 347ea91bea
commit 796b6b7289
2 changed files with 18 additions and 12 deletions

View File

@@ -1672,8 +1672,10 @@ async fn handle_sync_cmd(
"Ollama is not installed — embeddings will be skipped. {}",
result.install_hint.as_deref().unwrap_or("")
);
} else if result.started {
} else if result.started && result.running {
tracing::info!("Started ollama serve (was not running)");
} else if result.started {
tracing::info!("Spawned ollama serve (cold start in progress, should be ready by embed stage)");
} else if !result.running {
tracing::warn!(
"Failed to start Ollama: {}",