Skip to content

patch async-compression to compress responses in streaming #1604

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

Merged
merged 3 commits into from
Aug 26, 2022

Conversation

Geal
Copy link
Contributor

@Geal Geal commented Aug 25, 2022

Fix #1572

async-compression is used in tower-http's CompressionLayer. Inside the
AsyncRead based compression code, if the underlying stream returns
Poll::Pending, it will be returned directly, while in the case of
deferred responses, the next one might come way later, so we want to
send whatever data we have available right now.
We will have to switch to an AsyncWrite interface instead, which will be
more flexible, but considering the timing of the release, this patch
will hold for now.

This uses the code from Nullus157/async-compression#155

async-compression is used in tower-http's CompressionLayer. Inside the
AsyncRead based compression code, if the underlying stream returns
Poll::Pending, it will be returned directly, while in the case of
deferred responses, the next one might come way later, so we want to
send whatever data we have available right now.
We will have to switch to an AsyncWrite interface instead, which will be
more flexible, but considering the timing of the release, this patch
will hold for now
@github-actions

This comment has been minimized.

@Geal Geal requested review from garypen and o0Ignition0o August 25, 2022 08:32
@Geal Geal mentioned this pull request Aug 25, 2022
@Geal Geal added this to the v1.0.0-alpha.0 milestone Aug 25, 2022
@Geal Geal merged commit 0e0b64d into main Aug 26, 2022
@Geal Geal deleted the geal/chunk-compression branch August 26, 2022 10:54
@abernix abernix mentioned this pull request Aug 29, 2022
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.

deferred responses should be compressed
3 participants