From: Jérôme Benoit Date: Mon, 29 Jan 2024 19:56:05 +0000 (+0100) Subject: perf: add fastpath for trigger message handling X-Git-Tag: v1.2.33~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ef69bc46a13ffed7f2e1751f6689a1153c8106f9;p=e-mobility-charging-stations-simulator.git perf: add fastpath for trigger message handling 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 efc3acba..ef879925 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -83,6 +83,7 @@ import { OCPP16SupportedFeatureProfiles, type OCPP16TriggerMessageRequest, type OCPP16TriggerMessageResponse, + OCPP16TriggerMessageStatus, type OCPP16UpdateFirmwareRequest, type OCPP16UpdateFirmwareResponse, type OCPPConfigurationKey, @@ -446,7 +447,14 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { ) this.on( OCPP16IncomingRequestCommand.TRIGGER_MESSAGE, - (chargingStation: ChargingStation, request: OCPP16TriggerMessageRequest) => { + ( + chargingStation: ChargingStation, + request: OCPP16TriggerMessageRequest, + response: OCPP16TriggerMessageResponse + ) => { + if (response.status !== OCPP16TriggerMessageStatus.ACCEPTED) { + return + } const { requestedMessage, connectorId } = request const errorHandler = (error: Error): void => { logger.error( diff --git a/src/types/index.ts b/src/types/index.ts index 2ca7e8cc..0de12683 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -126,6 +126,7 @@ export { type OCPP16ReserveNowResponse, type OCPP16StatusNotificationResponse, type OCPP16TriggerMessageResponse, + OCPP16TriggerMessageStatus, type OCPP16UpdateFirmwareResponse, type SetChargingProfileResponse, type UnlockConnectorResponse