return this.workerOptions.elementsPerWorker;
}
+ /** @inheritDoc */
+ public async start(): Promise<void> {
+ this.addWorkerSetElement();
+ // Add worker set element sequentially to optimize memory at startup
+ this.workerOptions.workerStartDelay > 0 && (await sleep(this.workerOptions.workerStartDelay));
+ }
+
+ /** @inheritDoc */
+ public async stop(): Promise<void> {
+ for (const workerSetElement of this.workerSet) {
+ await workerSetElement.worker.terminate();
+ }
+ this.workerSet.clear();
+ }
+
/** @inheritDoc */
public async addElement(elementData: WorkerData): Promise<void> {
if (!this.workerSet) {
}
}
- /** @inheritDoc */
- public async start(): Promise<void> {
- this.addWorkerSetElement();
- // Add worker set element sequentially to optimize memory at startup
- this.workerOptions.workerStartDelay > 0 && (await sleep(this.workerOptions.workerStartDelay));
- }
-
- /** @inheritDoc */
- public async stop(): Promise<void> {
- for (const workerSetElement of this.workerSet) {
- await workerSetElement.worker.terminate();
- }
- this.workerSet.clear();
- }
-
/**
* Add a new `WorkerSetElement`.
*/