Ensure requests are purged from the cache in case of responses processing
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 11 Sep 2022 15:06:59 +0000 (17:06 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 11 Sep 2022 15:06:59 +0000 (17:06 +0200)
error

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStation.ts

index 1704821c053dca9e843c100c7d703bff082b61bd..53f9076f00572e5aebe4fedfecf9d6e4a62e3849 100644 (file)
@@ -1568,6 +1568,11 @@ export default class ChargingStation {
           error as OCPPError,
           commandName ?? requestCommandName ?? null
         );
+      } else if (
+        [MessageType.CALL_RESULT_MESSAGE, MessageType.CALL_ERROR_MESSAGE].includes(messageType)
+      ) {
+        // Remove the request from the cache
+        this.requests.delete(messageId);
       }
     }
   }