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

This commit is contained in:
Emil Pettersson 2021-02-26 22:18:46 +01:00 committed by GitHub
parent d57fd6cef0
commit a9b25dda85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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();
}
}