From 446aba69a37e65932cce2878c3edd47619595d3c Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 5 Jul 2022 10:57:00 +0200 Subject: [PATCH 01/16] stream: fix 0 transform hwm backpressure --- lib/internal/streams/transform.js | 13 ++++++++++--- test/parallel/test-stream-passthrough-drain.js | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index fdac76e4062b4b..5c46dda922ae47 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -82,6 +82,15 @@ function Transform(options) { if (!(this instanceof Transform)) return new Transform(options); + if (options && options.highWaterMark != null) { + options = { + ...options, + highWaterMark: null, + readableHighWaterMark: Math.max(1, options.highWaterMark), + writableHighWaterMark: 0 + } + } + Duplex.call(this, options); // We have implemented the _read method, and done the other things @@ -164,9 +173,7 @@ Transform.prototype._write = function(chunk, encoding, callback) { if ( wState.ended || // Backwards compat. length === rState.length || // Backwards compat. - rState.length < rState.highWaterMark || - rState.highWaterMark === 0 || - rState.length === 0 + rState.length < rState.highWaterMark ) { callback(); } else { diff --git a/test/parallel/test-stream-passthrough-drain.js b/test/parallel/test-stream-passthrough-drain.js index f5c98947e21e2e..04dba30414104c 100644 --- a/test/parallel/test-stream-passthrough-drain.js +++ b/test/parallel/test-stream-passthrough-drain.js @@ -1,8 +1,9 @@ 'use strict'; const common = require('../common'); +const assert = require('assert') const { PassThrough } = require('stream'); const pt = new PassThrough({ highWaterMark: 0 }); pt.on('drain', common.mustCall()); -pt.write('hello'); +assert(!pt.write('hello1')); pt.read(); From 67eaa2f46c2d01ec68d139c8d0d8be007fb6d7f0 Mon Sep 17 00:00:00 2001 From: Gil Pedersen Date: Tue, 5 Jul 2022 10:57:56 +0200 Subject: [PATCH 02/16] stream: add 0 hwm test --- test/parallel/test-stream-transform-hwm0.js | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/parallel/test-stream-transform-hwm0.js diff --git a/test/parallel/test-stream-transform-hwm0.js b/test/parallel/test-stream-transform-hwm0.js new file mode 100644 index 00000000000000..8e8971f21fa472 --- /dev/null +++ b/test/parallel/test-stream-transform-hwm0.js @@ -0,0 +1,28 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const { Transform } = require('stream'); + +const t = new Transform({ + objectMode: true, highWaterMark: 0, + transform(chunk, enc, callback) { + process.nextTick(() => callback(null, chunk, enc)); + } +}); + +assert.strictEqual(t.write(1), false); +t.on('drain', common.mustCall(() => { + assert.strictEqual(t.write(2), false); + t.end(); +})); + +t.once('readable', common.mustCall(() => { + assert.strictEqual(t.read(), 1); + setImmediate(common.mustCall(() => { + assert.strictEqual(t.read(), null); + t.once('readable', common.mustCall(() => { + assert.strictEqual(t.read(), 2); + })); + })); +})); From 4688771842f46b5980fad635c4be8ba8f7fa9749 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 5 Jul 2022 12:49:22 +0200 Subject: [PATCH 03/16] fixup! stream: fix 0 transform hwm backpressure --- lib/internal/streams/transform.js | 10 +++++++--- test/parallel/test-stream-transform-hwm0.js | 8 +++----- .../test-stream-transform-split-highwatermark.js | 15 --------------- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index 5c46dda922ae47..011f2687b8340a 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -82,12 +82,16 @@ function Transform(options) { if (!(this instanceof Transform)) return new Transform(options); - if (options && options.highWaterMark != null) { + // TODO (ronag): This should preferably always be + // applied but would be semver-major. + if (options && options.highWaterMark === 0) { options = { ...options, highWaterMark: null, - readableHighWaterMark: Math.max(1, options.highWaterMark), - writableHighWaterMark: 0 + readableHighWaterMark: Math.max(1, options.readableHighWaterMark || options.highWaterMark), + // TODO (ronag) This should preferably be 0, but we have + // a "bug" where we check needDrain before calling _write and not after. + writableHighWaterMark: options.writableHighWaterMark || 1 } } diff --git a/test/parallel/test-stream-transform-hwm0.js b/test/parallel/test-stream-transform-hwm0.js index 8e8971f21fa472..d6779369882b12 100644 --- a/test/parallel/test-stream-transform-hwm0.js +++ b/test/parallel/test-stream-transform-hwm0.js @@ -19,10 +19,8 @@ t.on('drain', common.mustCall(() => { t.once('readable', common.mustCall(() => { assert.strictEqual(t.read(), 1); - setImmediate(common.mustCall(() => { - assert.strictEqual(t.read(), null); - t.once('readable', common.mustCall(() => { - assert.strictEqual(t.read(), 2); - })); + assert.strictEqual(t.read(), null); + t.once('readable', common.mustCall(() => { + assert.strictEqual(t.read(), 2); })); })); diff --git a/test/parallel/test-stream-transform-split-highwatermark.js b/test/parallel/test-stream-transform-split-highwatermark.js index 22d13fd3c3b0e3..7ad9b94031460c 100644 --- a/test/parallel/test-stream-transform-split-highwatermark.js +++ b/test/parallel/test-stream-transform-split-highwatermark.js @@ -39,21 +39,6 @@ testTransform(555, 555, { writableHighWaterMark: 777, }); -// Test highWaterMark = 0 overriding -testTransform(0, 0, { - highWaterMark: 0, - readableHighWaterMark: 666, -}); -testTransform(0, 0, { - highWaterMark: 0, - writableHighWaterMark: 777, -}); -testTransform(0, 0, { - highWaterMark: 0, - readableHighWaterMark: 666, - writableHighWaterMark: 777, -}); - // Test undefined, null [undefined, null].forEach((v) => { testTransform(DEFAULT, DEFAULT, { readableHighWaterMark: v }); From 7b758da95cd12505ff6d490e9670d24e8df171fa Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 5 Jul 2022 12:50:49 +0200 Subject: [PATCH 04/16] fixup! stream: fix 0 transform hwm backpressure --- lib/internal/streams/transform.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index 011f2687b8340a..893388aea19a89 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -88,7 +88,7 @@ function Transform(options) { options = { ...options, highWaterMark: null, - readableHighWaterMark: Math.max(1, options.readableHighWaterMark || options.highWaterMark), + readableHighWaterMark: Math.max(1, options.readableHighWaterMark || options.highWaterMark || 1), // TODO (ronag) This should preferably be 0, but we have // a "bug" where we check needDrain before calling _write and not after. writableHighWaterMark: options.writableHighWaterMark || 1 From 150c51b95c243ebf1debca9fb928bdde0680444a Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 5 Jul 2022 12:52:10 +0200 Subject: [PATCH 05/16] fixup! stream: fix 0 transform hwm backpressure --- lib/internal/streams/transform.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index 893388aea19a89..232adee698f3d4 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -85,6 +85,9 @@ function Transform(options) { // TODO (ronag): This should preferably always be // applied but would be semver-major. if (options && options.highWaterMark === 0) { + // A Duplex will buffer both on the writable and readable side while + // a Transform just wants to buffer hwm number of elements. To avoid + // buffering twice we disable buffering on the writable side. options = { ...options, highWaterMark: null, From 2d5a05fecb04f056839f9bc06fcf00ff2502f4a4 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 5 Jul 2022 12:53:12 +0200 Subject: [PATCH 06/16] fixup! stream: fix 0 transform hwm backpressure --- lib/internal/streams/transform.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index 232adee698f3d4..a3ccdf11c9626c 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -94,6 +94,8 @@ function Transform(options) { readableHighWaterMark: Math.max(1, options.readableHighWaterMark || options.highWaterMark || 1), // TODO (ronag) This should preferably be 0, but we have // a "bug" where we check needDrain before calling _write and not after. + // Refs: https://github.com/nodejs/node/pull/32887 + // Refs: https://github.com/nodejs/node/pull/35941 writableHighWaterMark: options.writableHighWaterMark || 1 } } From 63e4e538f880f1f16c64077ee2b2da1e395743da Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 5 Jul 2022 12:55:37 +0200 Subject: [PATCH 07/16] fixup! stream: fix 0 transform hwm backpressure --- lib/internal/streams/transform.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index a3ccdf11c9626c..4dec770189bd6c 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -73,6 +73,7 @@ const { ERR_METHOD_NOT_IMPLEMENTED } = require('internal/errors').codes; const Duplex = require('internal/streams/duplex'); +const { getHighWaterMark } = require('internal/streams/state'); ObjectSetPrototypeOf(Transform.prototype, Duplex.prototype); ObjectSetPrototypeOf(Transform, Duplex); @@ -88,11 +89,12 @@ function Transform(options) { // A Duplex will buffer both on the writable and readable side while // a Transform just wants to buffer hwm number of elements. To avoid // buffering twice we disable buffering on the writable side. + const readableHighWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', true) options = { ...options, highWaterMark: null, - readableHighWaterMark: Math.max(1, options.readableHighWaterMark || options.highWaterMark || 1), - // TODO (ronag) This should preferably be 0, but we have + readableHighWaterMark: Math.max(1, readableHighWaterMark), + // TODO (ronag) This should be 0, but we have // a "bug" where we check needDrain before calling _write and not after. // Refs: https://github.com/nodejs/node/pull/32887 // Refs: https://github.com/nodejs/node/pull/35941 From ac2c5b394d8af73297650d422552e47723c696ac Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 5 Jul 2022 12:58:55 +0200 Subject: [PATCH 08/16] fixup! stream: fix 0 transform hwm backpressure --- lib/internal/streams/transform.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index 4dec770189bd6c..d7461494d357d4 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -94,11 +94,11 @@ function Transform(options) { ...options, highWaterMark: null, readableHighWaterMark: Math.max(1, readableHighWaterMark), - // TODO (ronag) This should be 0, but we have + // TODO (ronag) This is not optimal since we have // a "bug" where we check needDrain before calling _write and not after. // Refs: https://github.com/nodejs/node/pull/32887 // Refs: https://github.com/nodejs/node/pull/35941 - writableHighWaterMark: options.writableHighWaterMark || 1 + writableHighWaterMark: 0 } } From 3654d6ebfefb40b46ab7e16f356fc6b74061e799 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 5 Jul 2022 13:04:02 +0200 Subject: [PATCH 09/16] fixup! stream: fix 0 transform hwm backpressure --- lib/internal/streams/transform.js | 9 +++++---- test/parallel/test-stream-passthrough-drain.js | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index d7461494d357d4..00bb4fcb9abc9f 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -65,7 +65,8 @@ const { ObjectSetPrototypeOf, - Symbol + Symbol, + MathMax } = primordials; module.exports = Transform; @@ -89,17 +90,17 @@ function Transform(options) { // A Duplex will buffer both on the writable and readable side while // a Transform just wants to buffer hwm number of elements. To avoid // buffering twice we disable buffering on the writable side. - const readableHighWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', true) + const readableHighWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', true); options = { ...options, highWaterMark: null, - readableHighWaterMark: Math.max(1, readableHighWaterMark), + readableHighWaterMark: MathMax(1, readableHighWaterMark), // TODO (ronag) This is not optimal since we have // a "bug" where we check needDrain before calling _write and not after. // Refs: https://github.com/nodejs/node/pull/32887 // Refs: https://github.com/nodejs/node/pull/35941 writableHighWaterMark: 0 - } + }; } Duplex.call(this, options); diff --git a/test/parallel/test-stream-passthrough-drain.js b/test/parallel/test-stream-passthrough-drain.js index 04dba30414104c..8c61662c65c8e1 100644 --- a/test/parallel/test-stream-passthrough-drain.js +++ b/test/parallel/test-stream-passthrough-drain.js @@ -1,6 +1,6 @@ 'use strict'; const common = require('../common'); -const assert = require('assert') +const assert = require('assert'); const { PassThrough } = require('stream'); const pt = new PassThrough({ highWaterMark: 0 }); From 386f2ecc923fd3880a53a47640cd0fb8c4da5b4b Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Tue, 5 Jul 2022 13:09:27 +0200 Subject: [PATCH 10/16] fixup! stream: fix 0 transform hwm backpressure --- lib/internal/streams/transform.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index 00bb4fcb9abc9f..ec369e47a20b68 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -85,7 +85,8 @@ function Transform(options) { return new Transform(options); // TODO (ronag): This should preferably always be - // applied but would be semver-major. + // applied but would be semver-major. Or even better + // Make transform a Readable with the Writable interface. if (options && options.highWaterMark === 0) { // A Duplex will buffer both on the writable and readable side while // a Transform just wants to buffer hwm number of elements. To avoid From f93c687eef343e1f1a625da1abfed15937cc518f Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 6 Jul 2022 07:04:12 +0200 Subject: [PATCH 11/16] fixup! stream: fix 0 transform hwm backpressure --- lib/internal/streams/transform.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index ec369e47a20b68..85dfeb495d3777 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -87,11 +87,11 @@ function Transform(options) { // TODO (ronag): This should preferably always be // applied but would be semver-major. Or even better // Make transform a Readable with the Writable interface. - if (options && options.highWaterMark === 0) { + const readableHighWaterMark = options ? getHighWaterMark(this, options, 'readableHighWaterMark', true) : null; + if (readableHighWaterMark === 0) { // A Duplex will buffer both on the writable and readable side while // a Transform just wants to buffer hwm number of elements. To avoid // buffering twice we disable buffering on the writable side. - const readableHighWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', true); options = { ...options, highWaterMark: null, From f00b475917562db68faf5c5a6d520f570a922bdc Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 6 Jul 2022 07:12:42 +0200 Subject: [PATCH 12/16] fixup! stream: fix 0 transform hwm backpressure --- test/parallel/test-stream-transform-split-highwatermark.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/parallel/test-stream-transform-split-highwatermark.js b/test/parallel/test-stream-transform-split-highwatermark.js index 7ad9b94031460c..b6255c704710ac 100644 --- a/test/parallel/test-stream-transform-split-highwatermark.js +++ b/test/parallel/test-stream-transform-split-highwatermark.js @@ -20,10 +20,6 @@ testTransform(666, 777, { writableHighWaterMark: 777, }); -// test 0 overriding defaultHwm -testTransform(0, DEFAULT, { readableHighWaterMark: 0 }); -testTransform(DEFAULT, 0, { writableHighWaterMark: 0 }); - // Test highWaterMark overriding testTransform(555, 555, { highWaterMark: 555, From a6b44234fcff7aafdb247780013ccc409a943652 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 6 Jul 2022 07:28:49 +0200 Subject: [PATCH 13/16] fixup! stream: fix 0 transform hwm backpressure --- lib/internal/streams/transform.js | 6 +++--- test/parallel/test-stream-passthrough-drain.js | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index 85dfeb495d3777..882d7524045ae1 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -85,8 +85,8 @@ function Transform(options) { return new Transform(options); // TODO (ronag): This should preferably always be - // applied but would be semver-major. Or even better - // Make transform a Readable with the Writable interface. + // applied but would be semver-major. Or even better; + // make Transform a Readable with the Writable interface. const readableHighWaterMark = options ? getHighWaterMark(this, options, 'readableHighWaterMark', true) : null; if (readableHighWaterMark === 0) { // A Duplex will buffer both on the writable and readable side while @@ -95,7 +95,7 @@ function Transform(options) { options = { ...options, highWaterMark: null, - readableHighWaterMark: MathMax(1, readableHighWaterMark), + readableHighWaterMark, // TODO (ronag) This is not optimal since we have // a "bug" where we check needDrain before calling _write and not after. // Refs: https://github.com/nodejs/node/pull/32887 diff --git a/test/parallel/test-stream-passthrough-drain.js b/test/parallel/test-stream-passthrough-drain.js index 8c61662c65c8e1..244bf874073733 100644 --- a/test/parallel/test-stream-passthrough-drain.js +++ b/test/parallel/test-stream-passthrough-drain.js @@ -7,3 +7,4 @@ const pt = new PassThrough({ highWaterMark: 0 }); pt.on('drain', common.mustCall()); assert(!pt.write('hello1')); pt.read(); +pt.read(); From e3603d36fdd09dc4653209dca2998252eed2c1d7 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 6 Jul 2022 07:29:07 +0200 Subject: [PATCH 14/16] fixup! stream: add 0 hwm test --- test/parallel/test-stream-transform-hwm0.js | 44 +++++++++++---------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/test/parallel/test-stream-transform-hwm0.js b/test/parallel/test-stream-transform-hwm0.js index d6779369882b12..30dd2a5dc9546a 100644 --- a/test/parallel/test-stream-transform-hwm0.js +++ b/test/parallel/test-stream-transform-hwm0.js @@ -1,26 +1,28 @@ 'use strict'; -const common = require('../common'); -const assert = require('assert'); -const { Transform } = require('stream'); + const common = require('../common'); + const assert = require('assert'); + const { Transform } = require('stream'); -const t = new Transform({ - objectMode: true, highWaterMark: 0, - transform(chunk, enc, callback) { - process.nextTick(() => callback(null, chunk, enc)); - } -}); + const t = new Transform({ + objectMode: true, highWaterMark: 0, + transform(chunk, enc, callback) { + process.nextTick(() => callback(null, chunk, enc)); + } + }); -assert.strictEqual(t.write(1), false); -t.on('drain', common.mustCall(() => { - assert.strictEqual(t.write(2), false); - t.end(); -})); + assert.strictEqual(t.write(1), false); + t.on('drain', common.mustCall(() => { + assert.strictEqual(t.write(2), false); + t.end(); + })); -t.once('readable', common.mustCall(() => { - assert.strictEqual(t.read(), 1); - assert.strictEqual(t.read(), null); - t.once('readable', common.mustCall(() => { - assert.strictEqual(t.read(), 2); - })); -})); + t.once('readable', common.mustCall(() => { + assert.strictEqual(t.read(), 1); + setImmediate(common.mustCall(() => { + assert.strictEqual(t.read(), null); + t.once('readable', common.mustCall(() => { + assert.strictEqual(t.read(), 2); + })); + })); + })); From 71d66eccfc66201365dda9477926b538c1bd4013 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 6 Jul 2022 14:26:36 +0200 Subject: [PATCH 15/16] fixup n --- lib/internal/streams/transform.js | 1 - test/parallel/test-stream-transform-hwm0.js | 46 ++++++++++----------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index 882d7524045ae1..9ff140c7bf969a 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -66,7 +66,6 @@ const { ObjectSetPrototypeOf, Symbol, - MathMax } = primordials; module.exports = Transform; diff --git a/test/parallel/test-stream-transform-hwm0.js b/test/parallel/test-stream-transform-hwm0.js index 30dd2a5dc9546a..8e8971f21fa472 100644 --- a/test/parallel/test-stream-transform-hwm0.js +++ b/test/parallel/test-stream-transform-hwm0.js @@ -1,28 +1,28 @@ 'use strict'; - const common = require('../common'); - const assert = require('assert'); - const { Transform } = require('stream'); +const common = require('../common'); +const assert = require('assert'); +const { Transform } = require('stream'); - const t = new Transform({ - objectMode: true, highWaterMark: 0, - transform(chunk, enc, callback) { - process.nextTick(() => callback(null, chunk, enc)); - } - }); +const t = new Transform({ + objectMode: true, highWaterMark: 0, + transform(chunk, enc, callback) { + process.nextTick(() => callback(null, chunk, enc)); + } +}); - assert.strictEqual(t.write(1), false); - t.on('drain', common.mustCall(() => { - assert.strictEqual(t.write(2), false); - t.end(); - })); +assert.strictEqual(t.write(1), false); +t.on('drain', common.mustCall(() => { + assert.strictEqual(t.write(2), false); + t.end(); +})); - t.once('readable', common.mustCall(() => { - assert.strictEqual(t.read(), 1); - setImmediate(common.mustCall(() => { - assert.strictEqual(t.read(), null); - t.once('readable', common.mustCall(() => { - assert.strictEqual(t.read(), 2); - })); - })); - })); +t.once('readable', common.mustCall(() => { + assert.strictEqual(t.read(), 1); + setImmediate(common.mustCall(() => { + assert.strictEqual(t.read(), null); + t.once('readable', common.mustCall(() => { + assert.strictEqual(t.read(), 2); + })); + })); +})); From b426a13f2f472654e12f4023d7b1173eb0d23af0 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Mon, 11 Jul 2022 11:50:40 +0200 Subject: [PATCH 16/16] fixup: allow overriding writableHighWaterMark --- lib/internal/streams/transform.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/streams/transform.js b/lib/internal/streams/transform.js index 9ff140c7bf969a..ddd21f0fba9122 100644 --- a/lib/internal/streams/transform.js +++ b/lib/internal/streams/transform.js @@ -95,11 +95,11 @@ function Transform(options) { ...options, highWaterMark: null, readableHighWaterMark, - // TODO (ronag) This is not optimal since we have + // TODO (ronag): 0 is not optimal since we have // a "bug" where we check needDrain before calling _write and not after. // Refs: https://github.com/nodejs/node/pull/32887 // Refs: https://github.com/nodejs/node/pull/35941 - writableHighWaterMark: 0 + writableHighWaterMark: options.writableHighWaterMark || 0 }; }