Skip to content

Commit

Permalink
add x-accel-buffering
Browse files Browse the repository at this point in the history
  • Loading branch information
dhirving committed Aug 29, 2024
1 parent 1915ffa commit 58c1df9
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@ def query_execute(
ctx,
spec,
)
return StreamingResponse(output_generator, media_type="application/jsonlines")
return StreamingResponse(
output_generator,
media_type="application/jsonlines",
headers={
# Instruct the Kubernetes ingress to not buffer the response,
# so that keep-alives reach the client promptly.
"X-Accel-Buffering": "no"
},
)

# Mypy thinks that ExitStack might swallow an exception.
assert False, "This line is unreachable."
Expand Down

0 comments on commit 58c1df9

Please sign in to comment.