Skip to content

Commit b8e4b05

Browse files
committed
fixup! stream: readable read one buffer at a time
1 parent 01a9ec9 commit b8e4b05

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

test/parallel/test-stream-readable-needReadable.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ const asyncReadable = new Readable({
3232
});
3333

3434
asyncReadable.on('readable', common.mustCall(() => {
35-
if (asyncReadable.read() !== null) {
36-
// After each read(), the buffer is empty.
37-
// If the stream doesn't end now,
38-
// then we need to notify the reader on future changes.
39-
assert.strictEqual(asyncReadable._readableState.needReadable, true);
35+
while (asyncReadable.read() !== null) {
4036
}
37+
// If the stream doesn't end now,
38+
// then we need to notify the reader on future changes.
39+
assert.strictEqual(asyncReadable._readableState.needReadable || asyncReadable._readableState.ended, true);
4140
}, 2));
4241

4342
process.nextTick(common.mustCall(() => {

test/parallel/test-webstreams-pipeline.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const http = require('http');
181181
});
182182

183183
pipeline(rs, t, ws, common.mustSucceed(() => {
184-
assert.deepStrictEqual(values, ['HELLOWORLD']);
184+
assert.deepStrictEqual(values, ['HELLO', 'WORLD']);
185185
}));
186186

187187
c.enqueue('hello');

0 commit comments

Comments
 (0)