refactor: cleanup pool start timestamp handling
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 30 Apr 2024 18:47:04 +0000 (20:47 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Tue, 30 Apr 2024 18:47:04 +0000 (20:47 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/pools/abstract-pool.ts

index e18f149997cf1d3f29f2589626f1024f697320c5..4f60dff0279643a864b8c570eaddf3e3af9e7546 100644 (file)
@@ -1088,9 +1088,9 @@ export abstract class AbstractPool<
     }
     this.starting = true
     this.startMinimumNumberOfWorkers()
+    this.startTimestamp = performance.now()
     this.starting = false
     this.started = true
-    this.startTimestamp = performance.now()
   }
 
   /** @inheritDoc */
@@ -1113,9 +1113,9 @@ export abstract class AbstractPool<
     this.emitter?.emit(PoolEvents.destroy, this.info)
     this.emitter?.emitDestroy()
     this.readyEventEmitted = false
+    delete this.startTimestamp
     this.destroying = false
     this.started = false
-    delete this.startTimestamp
   }
 
   private async sendKillMessageToWorker (workerNodeKey: number): Promise<void> {