stream: don't try to read more if reading

Avoid unnecessary nextTick.

PR-URL: https://github.com/nodejs/node/pull/60454
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
This commit is contained in:
Robert Nagy
2025-10-30 09:55:51 +01:00
committed by GitHub
parent b470ba08e1
commit 3dba25fbd2

View File

@@ -853,7 +853,7 @@ function emitReadable_(stream) {
// However, if we're not ended, or reading, and the length < hwm,
// then go ahead and try to read some more preemptively.
function maybeReadMore(stream, state) {
if ((state[kState] & (kReadingMore | kConstructed)) === kConstructed) {
if ((state[kState] & (kReadingMore | kReading | kConstructed)) === kConstructed) {
state[kState] |= kReadingMore;
process.nextTick(maybeReadMore_, stream, state);
}