-
Notifications
You must be signed in to change notification settings - Fork 98
Description
disclaimer: this is about fixing apollographql/router#1572, for which I'm under tight timing constraints, so right now this issue's goal (and the related PR) is discussing and finding a quick fix that we can use directly in the router, and then I'll help find a proper solution.
I'm encountering an issue with the following setup:
- I use axum with tower-http's
CompressionLayer
, which uses async-compression - the router sends a HTTP response with multipart
- one multipart element is sent right away, the next one is sent after 5s
- if the response is compressed, the router will wait for 5s to send both parts at the same time, while without compression, the first part comes immediately, and the second one after 5s
I tracked that down to async-compression, where in the tokio based Encoder
, due to the use of ready!()
, whenever the underlying reader returns Poll::Pending
, it is transmitted directly to the caller, so there is no flush until the entire data has been read:
I would like the encoder to send the data it already compressed when the reader returned Poll::Pending
, and let the upper layer decide on buffering or sending the HTTP chunk directly.