Completely clean the bundler once a client gets disconnected

Reviewed By: BYK

Differential Revision: D7211827

fbshipit-source-id: 4490d2f520b24595a1d5833b69ecca3e408ba3c5
This commit is contained in:
Rafael Oleza 2018-03-09 16:38:56 -08:00 committed by Facebook Github Bot
parent c26a68e5c7
commit 13f9ea7d3a
2 changed files with 3 additions and 3 deletions

View File

@ -144,7 +144,7 @@ class DeltaTransformer extends EventEmitter {
* clean up memory and resources once this instance is not used anymore.
*/
end() {
this._deltaCalculator.removeListener('change', this._onFileChange);
this.removeAllListeners();
return this._deltaCalculator.end();
}

View File

@ -89,9 +89,9 @@ class HmrServer<TClient: Client> {
}
onClientDisconnect(client: TClient) {
// We can safely remove all listeners from the delta transformer since the
// We can safely stop the delta transformer since the
// transformer is not shared between clients.
client.deltaTransformer.removeAllListeners('change');
client.deltaTransformer.end();
}
async _handleFileChange(client: Client) {