fix: send initial SSE keepalive in /api/flow to flush response headers#251
Open
vivekchand wants to merge 1 commit intomainfrom
Open
fix: send initial SSE keepalive in /api/flow to flush response headers#251vivekchand wants to merge 1 commit intomainfrom
vivekchand wants to merge 1 commit intomainfrom
Conversation
…s immediately
The /api/flow SSE endpoint was hanging on initial connection because the
Flask/waitress server buffers the response until data is yielded. Added a
keepalive SSE comment as the first yield so HTTP headers are flushed
immediately, allowing E2E health checks to verify the endpoint returns 200.
This also improves client compatibility — EventSource clients now receive
the connection confirmation without waiting for the first real event.
Fixes E2E test failure: curl -w '%{http_code}' returned 000 (timeout) instead of 200.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
/api/flowSSE endpoint hangs on initial HTTP connection —curl -w '%{http_code}'returns000(timeout) instead of200, causing E2E health checks to fail.Root cause: Flask/waitress buffers the streaming response until actual data is yielded. Since
/api/flowonly yields events when new log activity occurs, a quiet dashboard causes HTTP headers to never flush, leaving clients stuck indefinitely.Fix
Add SSE comment (
: keepalive) as the very first yield ingenerate(). SSE comments are spec-valid and silently ignored by EventSource clients but force headers to flush immediately.Impact