Skip to content

Commit

Permalink
Do not defer the call to pumpTo with kj::evalNow
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed May 24, 2023
1 parent 069a825 commit de23514
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/workerd/api/streams/readable.c++
Original file line number Diff line number Diff line change
Expand Up @@ -472,11 +472,9 @@ kj::Promise<DeferredProxy<void>> ReadableStream::pumpTo(
bool end) {
JSG_REQUIRE(IoContext::hasCurrent(), Error,
"Unable to consume this ReadableStream outside of a request");
return kj::evalNow([&]() -> kj::Promise<DeferredProxy<void>> {
JSG_REQUIRE(!isDisturbed(), TypeError, "The ReadableStream has already been read.");
JSG_REQUIRE(!isLocked(), TypeError, "The ReadableStream has been locked to a reader.");
return getController().pumpTo(js, kj::mv(sink), end);
});
JSG_REQUIRE(!isDisturbed(), TypeError, "The ReadableStream has already been read.");
JSG_REQUIRE(!isLocked(), TypeError, "The ReadableStream has been locked to a reader.");
return getController().pumpTo(js, kj::mv(sink), end);
}

jsg::Ref<ReadableStream> ReadableStream::constructor(
Expand Down

0 comments on commit de23514

Please sign in to comment.