From: Jérôme Benoit Date: Wed, 29 Nov 2023 14:27:19 +0000 (+0100) Subject: fix: ensure event listeners are always removed at simulator stop X-Git-Tag: v1.2.27~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ee7c1da0e12c70134f31537a1c1e7040d309af5a;p=e-mobility-charging-stations-simulator.git fix: ensure event listeners are always removed at simulator stop Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 9fc4f19f..66207645 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -194,6 +194,7 @@ export class Bootstrap extends EventEmitter { } await this.workerImplementation?.stop(); delete this.workerImplementation; + this.removeAllListeners(); this.uiServer?.stop(); await this.storage?.close(); delete this.storage; @@ -229,7 +230,6 @@ export class Bootstrap extends EventEmitter { this.numberOfChargingStations, ) .then(() => { - this.removeAllListeners(); resolve('Charging stations stopped'); }) .catch(reject)