Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use buffered IO to enable streaming responses, and implement flush component #802

Merged
merged 15 commits into from
Jun 25, 2024

Conversation

a-h
Copy link
Owner

@a-h a-h commented Jun 22, 2024

Fixes #207
Resolves #458

See #781 (reply in thread) for discussion

@a-h a-h marked this pull request as draft June 22, 2024 12:47
@a-h
Copy link
Owner Author

a-h commented Jun 22, 2024

The ComponentHandler that's used for HTTP currently renders everything to an internal buffer, so that if there's an error during template rendering, the correct HTTP status code can be used.

So, there is likely a need for a streaming version of the Handler function, e.g. StreamingHandler which doesn't do that, or a streaming mode of operation for the existing version.

@a-h a-h marked this pull request as ready for review June 22, 2024 14:17
@a-h a-h requested a review from joerdav June 22, 2024 14:17
@joerdav
Copy link
Collaborator

joerdav commented Jun 24, 2024

This makes sense to me, it took a minute for me to understand what the point was, but I get it now.

I think this needs thorough docs, not just around how to use it, but when and why you would use it with examples.

@joerdav
Copy link
Collaborator

joerdav commented Jun 25, 2024

You read my mind on the non-flushable streams error, I was going to ask about that.

@a-h a-h merged commit df80639 into main Jun 25, 2024
7 checks passed
@a-h a-h deleted the flush_781 branch June 26, 2024 08:46
@a-h a-h restored the flush_781 branch June 26, 2024 08:46
@a-h a-h deleted the flush_781 branch June 26, 2024 08:46
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.

runtime: Optimization Request: Improve TTFB by Streaming Rendered HTML
2 participants