fix: race-condition in electron.net (#27938)

This commit is contained in:
Keeley Hammond
2021-03-01 10:50:03 -08:00
committed by GitHub
parent 0baf9997ad
commit e7e1801443

View File

@@ -119,10 +119,13 @@ class IncomingMessage extends Readable {
this._shouldPush = this.push(chunk);
}
if (this._shouldPush && this._resume) {
this._resume();
// Reset the callback, so that a new one is used for each
// batch of throttled data
// batch of throttled data. Do this before calling resume to avoid a
// potential race-condition
const resume = this._resume;
this._resume = null;
resume();
}
}