Skip to content

Commit 1febc95

Browse files
authored
Remove use of highWatermark option (#125)
1 parent 4d233d3 commit 1febc95

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

source/stream.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ const getStreamIterable = async function * (stream) {
3131
handleStreamEnd(stream, controller, state);
3232

3333
try {
34-
for await (const [chunk] of nodeImports.events.on(stream, 'data', {
35-
signal: controller.signal,
36-
highWatermark: stream.readableHighWaterMark,
37-
})) {
34+
for await (const [chunk] of nodeImports.events.on(stream, 'data', {signal: controller.signal})) {
3835
yield chunk;
3936
}
4037
} catch (error) {

test/stream.js

-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {once} from 'node:events';
2-
import {version} from 'node:process';
32
import {Readable, Duplex} from 'node:stream';
43
import {scheduler, setTimeout as pSetTimeout} from 'node:timers/promises';
54
import test from 'ava';
@@ -267,30 +266,6 @@ const testMultipleReads = async (t, wait) => {
267266
test('Handles multiple successive fast reads', testMultipleReads, () => scheduler.yield());
268267
test('Handles multiple successive slow reads', testMultipleReads, () => pSetTimeout(100));
269268

270-
// The `highWaterMark` option was added to `once()` by Node 20.
271-
// See https://github.com/nodejs/node/pull/41276
272-
const nodeMajor = version.split('.')[0].slice(1);
273-
if (nodeMajor >= 20) {
274-
test('Pause stream when too much data at once', async t => {
275-
const stream = new Readable({
276-
read: onetime(function () {
277-
this.push('.');
278-
this.push('.');
279-
this.push('.');
280-
this.push('.');
281-
this.push(null);
282-
}),
283-
highWaterMark: 2,
284-
});
285-
const [result] = await Promise.all([
286-
getStream(stream),
287-
once(stream, 'pause'),
288-
]);
289-
t.is(result, '....');
290-
assertSuccess(t, stream, Readable);
291-
});
292-
}
293-
294269
test('Can call twice at the same time', async t => {
295270
const stream = Readable.from(fixtureMultiString);
296271
const [result, secondResult] = await Promise.all([

0 commit comments

Comments
 (0)