Skip to content

Commit

Permalink
stream: fix Writable.destroy performance regression
Browse files Browse the repository at this point in the history
Ref: #50409
PR-URL: #50478
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
ronag authored and UlisesGascon committed Dec 11, 2023
1 parent c1a196c commit 6012e3e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/streams/writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,7 @@ Writable.prototype.destroy = function(err, cb) {
const state = this._writableState;

// Invoke pending callbacks.
if ((state[kState] & (kBuffered | kOnFinished | kDestroyed)) !== kDestroyed) {
if ((state[kState] & (kBuffered | kOnFinished)) !== 0 && (state[kState] & kDestroyed) === 0) {
process.nextTick(errorBuffer, state);
}

Expand Down

0 comments on commit 6012e3e

Please sign in to comment.