From: Jérôme Benoit Date: Tue, 4 Oct 2022 09:43:41 +0000 (+0200) Subject: Fix type cast at AsyncResource usage X-Git-Tag: v1.1.76~14 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=64818750b8394051b2a77ccf27ea4c2ff2b7af6e;p=e-mobility-charging-stations-simulator.git Fix type cast at AsyncResource usage Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index e32c3c98..a6d3031c 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -96,10 +96,12 @@ export default class AutomaticTransactionGenerator extends AsyncResource { this.internalStartConnector.bind(this) as ( this: AutomaticTransactionGenerator, ...args: any[] - ) => void, + ) => Promise, this, connectorId - ); + ).catch(() => { + /* This is intentional */ + }); } else if (this.connectorsStatus.get(connectorId)?.start === true) { logger.warn(`${this.logPrefix(connectorId)} is already started on connector`); } diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index f7e4489a..1ad01827 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -379,14 +379,18 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer chargingStation: ChargingStation, commandPayload: ResetRequest ): DefaultResponse { - this.asyncResource.runInAsyncScope( - chargingStation.reset.bind(chargingStation) as ( - this: ChargingStation, - ...args: any[] - ) => void, - chargingStation, - (commandPayload.type + 'Reset') as OCPP16StopTransactionReason - ); + this.asyncResource + .runInAsyncScope( + chargingStation.reset.bind(chargingStation) as ( + this: ChargingStation, + ...args: any[] + ) => Promise, + chargingStation, + (commandPayload.type + 'Reset') as OCPP16StopTransactionReason + ) + .catch(() => { + /* This is intentional */ + }); logger.info( `${chargingStation.logPrefix()} ${ commandPayload.type