Skip to content

fix(rag): add sse keepalive heartbeat to prevent nginx 60s timeout#435

Merged
AndreLiar merged 1 commit into
mainfrom
dev
Jun 15, 2026
Merged

fix(rag): add sse keepalive heartbeat to prevent nginx 60s timeout#435
AndreLiar merged 1 commit into
mainfrom
dev

Conversation

@AndreLiar

Copy link
Copy Markdown
Owner

Merges #434.

RAG chat was stuck on "Retrieving context…" in prod because nginx's proxy_read_timeout (60s) killed the SSE connection before the first event — the embedding phase takes 3–5 min on CPU-only ollama. Added a 20s SSE comment heartbeat to keep the connection alive.

1449 backend + 521 frontend tests pass.

)

the embedding phase (multi-query expansion via cpu-only ollama) can take
several minutes. nginx's proxy_read_timeout (60s default) was killing the
idle sse connection before any event was flushed, leaving the ui stuck on
"retrieving context…" forever.

send a sse comment (: keepalive) every 20s to keep the connection alive
through the entire pipeline duration.
@codecov-commenter

codecov-commenter commented Jun 15, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
backend/controllers/ragController.js 0.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

@AndreLiar AndreLiar merged commit cd266ca into main Jun 15, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants