From 507a34c154d4877cc261df07b942bcef01b87b4b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Wed, 7 Jun 2023 01:15:57 +0200 Subject: [PATCH] fix: ensure firmware update simulation always run as async resource MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../ocpp/1.6/OCPP16IncomingRequestService.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; -- 2.34.1