Skip to content

Commit

Permalink
stream: fix Writable.destroy performance regression
Browse files Browse the repository at this point in the history
Ref: nodejs#50409
PR-URL: nodejs#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 Trott committed Oct 31, 2023
1 parent 3daa0a6 commit c4decd7
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 c4decd7

Please sign in to comment.