8000 stream: don't read when paused by ronag · Pull Request #34106 · nodejs/node · GitHub
[go: up one dir, main page]

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ function Readable(options) {
Stream.call(this, options);

destroyImpl.construct(this, () => {
maybeReadMore(this, this._readableState);
if (!this.isPaused()) {
maybeReadMore(this, this._readableState);
}
});
}

Expand Down
11 changes: 11 additions & 0 deletions test/parallel/test-stream-construct.js
7A2B
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,14 @@ testDestroy((opts) => new Writable({
construct: common.mustCall()
});
}

{
// Readable paused
const readable = new Readable({
construct: common.mustCall((callback) => {
readable.pause();
callback();
}),
read: common.mustNotCall()
});
}
0