From: Jérôme Benoit Date: Sat, 2 Oct 2021 10:01:57 +0000 (+0200) Subject: Use return consistently in sendMessage() X-Git-Tag: v1.1.23~4 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f373ee97f9b8b64fe73c8c32d80591afcfca0a6c;p=e-mobility-charging-stations-simulator.git Use return consistently in sendMessage() Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 842b6446..b72b596c 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -56,11 +56,10 @@ export default abstract class OCPPRequestService { // Response? if (messageType !== MessageType.CALL_MESSAGE) { // Yes: send Ok - resolve(commandParams); - } else { - // Send timeout - setTimeout(() => rejectCallback(new OCPPError(ErrorType.GENERIC_ERROR, `Timeout for message id '${messageId}' with content '${messageToSend}'`, commandParams?.details ?? {}), false), Constants.OCPP_SOCKET_TIMEOUT); + return resolve(commandParams); } + // Send timeout + setTimeout(() => rejectCallback(new OCPPError(ErrorType.GENERIC_ERROR, `Timeout for message id '${messageId}' with content '${messageToSend}'`, commandParams?.details ?? {}), false), Constants.OCPP_SOCKET_TIMEOUT); /** * Function that will receive the request's response