From b57341bfa1d996e86ed8d1f577a780af9ae1cb00 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 22 Jan 2024 00:41:29 -0800 Subject: [PATCH] Remove unnecessary coroutine from streams/compression.c++ --- src/workerd/api/streams/compression.c++ | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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;