From: Jérôme Benoit Date: Tue, 6 Jun 2023 23:15:57 +0000 (+0200) Subject: fix: ensure firmware update simulation always run as async resource X-Git-Tag: v1.2.16~4 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=507a34c154d4877cc261df07b942bcef01b87b4b;p=e-mobility-charging-stations-simulator.git fix: ensure firmware update simulation always run as async resource Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index cdede34b..21da0052 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -1085,7 +1085,14 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { ).catch(Constants.EMPTY_FUNCTION); } else { setTimeout(() => { - this.updateFirmwareSimulation(chargingStation).catch(Constants.EMPTY_FUNCTION); + this.runInAsyncScope( + this.updateFirmwareSimulation.bind(this) as ( + this: OCPP16IncomingRequestService, + ...args: any[] + ) => Promise, + this, + chargingStation + ).catch(Constants.EMPTY_FUNCTION); }, retrieveDate?.getTime() - now); } return OCPP16Constants.OCPP_RESPONSE_EMPTY;