/**
* The start timestamp of the pool.
*/
- private readonly startTimestamp
+ private startTimestamp?: number
/**
* Constructs a new poolifier pool.
if (this.opts.startWorkers === true) {
this.start()
}
-
- this.startTimestamp = performance.now()
}
private checkPoolType (): void {
* @returns The pool utilization.
*/
private get utilization (): number {
+ if (this.startTimestamp == null) {
+ return 0
+ }
const poolTimeCapacity =
(performance.now() - this.startTimestamp) *
(this.maximumNumberOfWorkers ?? this.minimumNumberOfWorkers)
this.startMinimumNumberOfWorkers()
this.starting = false
this.started = true
+ this.startTimestamp = performance.now()
}
/** @inheritDoc */
this.readyEventEmitted = false
this.destroying = false
this.started = false
+ delete this.startTimestamp
}
private async sendKillMessageToWorker (workerNodeKey: number): Promise<void> {