repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix UI services Postman requests collection
[e-mobility-charging-stations-simulator.git]
/
src
/
worker
/
WorkerSet.ts
diff --git
a/src/worker/WorkerSet.ts
b/src/worker/WorkerSet.ts
index 6e890902d8f8c769e726a262e5c013c39334b604..956d97de0f07b54f0ce627f4620642205963de2a 100644
(file)
--- a/
src/worker/WorkerSet.ts
+++ b/
src/worker/WorkerSet.ts
@@
-1,9
+1,9
@@
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
// Partial Copyright Jerome Benoit. 2021. All Rights Reserved.
-import { Worker
Data, WorkerMessageEvents, WorkerOptions, WorkerSetElement } from '../types/Worker
';
+import { Worker
} from 'worker_threads
';
+import { WorkerData, WorkerMessageEvents, WorkerOptions, WorkerSetElement } from '../types/Worker';
import Utils from '../utils/Utils';
import Utils from '../utils/Utils';
-import { Worker } from 'worker_threads';
import WorkerAbstract from './WorkerAbstract';
import { WorkerUtils } from './WorkerUtils';
import WorkerAbstract from './WorkerAbstract';
import { WorkerUtils } from './WorkerUtils';
@@
-46,6
+46,7
@@
export default class WorkerSet extends WorkerAbstract<WorkerData> {
throw new Error("Cannot add a WorkerSet element: workers' set does not exist");
}
if (
throw new Error("Cannot add a WorkerSet element: workers' set does not exist");
}
if (
+ this.workerSet.size === 0 ||
this.getLastWorkerSetElement().numberOfWorkerElements >= this.workerOptions.elementsPerWorker
) {
await this.startWorker();
this.getLastWorkerSetElement().numberOfWorkerElements >= this.workerOptions.elementsPerWorker
) {
await this.startWorker();