refactor(simulator): remove unneeded duplicate initialization at startup
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 2 Feb 2023 20:39:53 +0000 (21:39 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 2 Feb 2023 20:39:53 +0000 (21:39 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/Bootstrap.ts

index b14952436e4c6a3ddd008760897301c5d80b4e62..7a823e56f3ed7f253db079fbf8482d188528ecf4 100644 (file)
@@ -49,17 +49,16 @@ export class Bootstrap {
   private readonly workerScript: string;
 
   private constructor() {
-    this.started = false;
-    this.workerImplementation = null;
     // Enable unconditionally for now
     this.logUnhandledRejection();
     this.logUncaughtException();
+    this.started = false;
+    this.workerImplementation = null;
     this.workerScript = path.join(
       path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../'),
       'charging-station',
       `ChargingStationWorker${path.extname(fileURLToPath(import.meta.url))}`
     );
-    this.initializeCounters();
     Configuration.getUIServer().enabled === true &&
       (this.uiServer = UIServerFactory.getUIServerImplementation(Configuration.getUIServer()));
     Configuration.getPerformanceStorage().enabled === true &&
@@ -145,8 +144,6 @@ export class Bootstrap {
 
   public async restart(): Promise<void> {
     await this.stop();
-    this.initializeCounters();
-    this.initializeWorkerImplementation();
     await this.start();
   }