diff --git a/Cargo.lock b/Cargo.lock index 3acabff190..2fcb30ded0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -364,8 +364,7 @@ dependencies = [ [[package]] name = "async-compression" version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345fd392ab01f746c717b1357165b76f0b67a60192007b234058c9045fdcf695" +source = "git+https://github.com/geal/async-compression?branch=encoder-flush#9800cd0d36be7f3414fbb98b25f9f61900ec8c7c" dependencies = [ "brotli", "flate2", diff --git a/Cargo.toml b/Cargo.toml index 609df9e60c..fd3fb480e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,3 +32,11 @@ members = [ # debug = false strip = "debuginfo" incremental = false + +# Temporary patch to async-compression +# It is used by tower-http's CompressionLayer. The compression code was not handling +# the Poll::Pending result from the underlying stream, so it was accumulating the +# entire compressed response in memory before sending it, which creates issues with +# deferred responses getting received too late +[patch.crates-io] +async-compression = { git = 'https://github.com/geal/async-compression', branch = 'encoder-flush' } \ No newline at end of file diff --git a/NEXT_CHANGELOG.md b/NEXT_CHANGELOG.md index 5d911c6c8d..f4d4eebbe7 100644 --- a/NEXT_CHANGELOG.md +++ b/NEXT_CHANGELOG.md @@ -170,6 +170,14 @@ next chunk to see the delimiter. By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1596 +### Patch async-compression to compress responses in streaming ([PR #1604](https://github.com/apollographql/router/issues/1604)) + +async-compression is a dependency used for response compression. Its implementation accumulates the entire compressed response +in memory before sending it, which creates problems for deferred responses, where we want the responses to come as soon as +possible, and not all at once after a while. + +By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/1604 + ## 🛠 Maintenance ### Depend on published `router-bridge` ([PR #1613](https://github.com/apollographql/router/issues/1613))