Skip to content

Commit 3999944

Browse files
mrviduusclaude
andcommitted
fix(ollama): worker reaches ollama via service name + bump timeouts 30s→90s
Two distinct prod failures behind the 15% vocab-enrichment success rate: 1. Worker was hitting http://localhost:11434 because docker-compose only set Ollama__BaseUrl on the api service, not the worker. Without the env override, appsettings.json's "http://localhost:11434" stayed in effect — every BookMetadataGenerator call logged "Connection refused". Fix: add Ollama__BaseUrl + Ollama__Model to the worker env block, mirroring the api block. 2. API was reaching Ollama fine (http://ollama:11434) but timing out at 30s — gemma4:e4b is CPU-only on this box (no GPU), 100% CPU, first inference after model load is comfortably north of 30s. Fix: bump Ollama:TimeoutSeconds 30 → 90 in both api and worker appsettings. Net effect on the article: distractor/hint/explanation success rate should climb from 15% to ~100% once deployed. Will re-collect stats after rollout before publishing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 26186b7 commit 3999944

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

backend/src/Api/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"Ollama": {
4646
"BaseUrl": "http://localhost:11434",
4747
"Model": "gemma4:e4b",
48-
"TimeoutSeconds": 30
48+
"TimeoutSeconds": 90
4949
},
5050
"LLM": {
5151
"DefaultProvider": "openai",

backend/src/Worker/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"Ollama": {
1313
"BaseUrl": "http://localhost:11434",
1414
"Model": "gemma4:e4b",
15-
"TimeoutSeconds": 30
15+
"TimeoutSeconds": 90
1616
},
1717
"LLM": {
1818
"DefaultProvider": "ollama",

docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ services:
110110
ConnectionStrings__Default: "Host=db;Port=5432;Database=${POSTGRES_DB};Username=${POSTGRES_USER};Password=${POSTGRES_PASSWORD}"
111111
Storage__RootPath: /storage
112112
Search__Provider: ${SEARCH_PROVIDER:-postgres}
113+
# Worker reaches Ollama via the Docker service name, not localhost
114+
# (without this override it falls back to appsettings.json's
115+
# "http://localhost:11434" and silently fails every vocab-enrichment
116+
# call — symptom: words save with NULL distractors/hint/explanation).
117+
Ollama__BaseUrl: http://ollama:11434
118+
Ollama__Model: gemma4:e4b
113119
OTEL_EXPORTER_OTLP_ENDPOINT: http://aspire-dashboard:18889
114120
volumes:
115121
- ./data/storage:/storage

0 commit comments

Comments
 (0)