Skip to content

Commit 87b9bce

Browse files
committed
stream: always defer readable in EOF when sync
Fix a regression introduced by #18515 that broke the dicer module tests. See: #18515 PR-URL: #18615 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent d8f7338 commit 87b9bce

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/_stream_readable.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -488,9 +488,9 @@ function onEofChunk(stream, state) {
488488
}
489489
state.ended = true;
490490

491-
if (state.sync && state.length) {
492-
// if we are sync and have data in the buffer, wait until next tick
493-
// to emit the data. otherwise we risk emitting data in the flow()
491+
if (state.sync) {
492+
// if we are sync, wait until next tick to emit the data.
493+
// Otherwise we risk emitting data in the flow()
494494
// the readable code triggers during a read() call
495495
emitReadable(stream);
496496
} else {

test/parallel/test-stream-readable-object-multi-push-async.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const BATCH = 10;
160160
});
161161

162162
readable.on('end', common.mustCall(() => {
163-
assert.strictEqual(nextTickPassed, false);
163+
assert.strictEqual(nextTickPassed, true);
164164
}));
165165
}
166166

0 commit comments

Comments
 (0)