diff --git a/src/workerd/api/streams/compression.c++ b/src/workerd/api/streams/compression.c++ index a32b79d9f87..89ad7ec327c 100644 --- a/src/workerd/api/streams/compression.c++ +++ b/src/workerd/api/streams/compression.c++ @@ -173,12 +173,11 @@ public: kj::throwFatalException(kj::cp(exception)); } KJ_CASE_ONEOF(open, Open) { - for (auto &piece : pieces) { - if (piece.size() != 0) { - co_await write(piece.begin(), piece.size()); - } - } - co_return; + if (pieces.size() == 0) return kj::READY_NOW; + return write(pieces[0].begin(), pieces[0].size()) + .then([this, pieces = pieces.slice(1)]() mutable { + return write(pieces); + }); } } KJ_UNREACHABLE;