perf: remove AsyncResource usage
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / 1.6 / OCPP16IncomingRequestService.ts
index 8faf05cf609676ebca14249de5139edd215a3055..6dae5c8ad51c17f66f332906bd44c0067d7720de 100644 (file)
@@ -445,14 +445,9 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     commandPayload: ResetRequest,
   ): GenericResponse {
     const { type } = commandPayload;
-    this.runInAsyncScope(
-      chargingStation.reset.bind(chargingStation) as (
-        this: ChargingStation,
-        ...args: unknown[]
-      ) => Promise<void>,
-      chargingStation,
-      `${type}Reset` as OCPP16StopTransactionReason,
-    ).catch(Constants.EMPTY_FUNCTION);
+    chargingStation
+      .reset(`${type}Reset` as OCPP16StopTransactionReason)
+      .catch(Constants.EMPTY_FUNCTION);
     logger.info(
       `${chargingStation.logPrefix()} ${type} reset command received, simulating it. The station will be back online in ${formatDurationMilliSeconds(
         chargingStation.stationInfo.resetTime!,
@@ -1122,25 +1117,11 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService {
     retrieveDate = convertToDate(retrieveDate)!;
     const now = Date.now();
     if (retrieveDate?.getTime() <= now) {
-      this.runInAsyncScope(
-        this.updateFirmwareSimulation.bind(this) as (
-          this: OCPP16IncomingRequestService,
-          ...args: unknown[]
-        ) => Promise<void>,
-        this,
-        chargingStation,
-      ).catch(Constants.EMPTY_FUNCTION);
+      this.updateFirmwareSimulation(chargingStation).catch(Constants.EMPTY_FUNCTION);
     } else {
       setTimeout(
         () => {
-          this.runInAsyncScope(
-            this.updateFirmwareSimulation.bind(this) as (
-              this: OCPP16IncomingRequestService,
-              ...args: unknown[]
-            ) => Promise<void>,
-            this,
-            chargingStation,
-          ).catch(Constants.EMPTY_FUNCTION);
+          this.updateFirmwareSimulation(chargingStation).catch(Constants.EMPTY_FUNCTION);
         },
         retrieveDate?.getTime() - now,
       );