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: wait for worker exit to clean the worker set
[e-mobility-charging-stations-simulator.git]
/
src
/
worker
/
WorkerSet.ts
diff --git
a/src/worker/WorkerSet.ts
b/src/worker/WorkerSet.ts
index 2514d7239a24dc01baeb98f22c8a492c0f574260..42109a98567609739d70a4e00c3c10d6e7420d07 100644
(file)
--- a/
src/worker/WorkerSet.ts
+++ b/
src/worker/WorkerSet.ts
@@
-77,15
+77,15
@@
export class WorkerSet extends WorkerAbstract<WorkerData> {
/** @inheritDoc */
public async stop(): Promise<void> {
for (const workerSetElement of this.workerSet) {
/** @inheritDoc */
public async stop(): Promise<void> {
for (const workerSetElement of this.workerSet) {
+ const worker = workerSetElement.worker;
const workerExitPromise = new Promise<void>((resolve) => {
const workerExitPromise = new Promise<void>((resolve) => {
- worker
SetElement.worker
.on('exit', () => {
+ worker.on('exit', () => {
resolve();
});
});
resolve();
});
});
- await worker
SetElement.worker
.terminate();
+ await worker.terminate();
await workerExitPromise;
}
await workerExitPromise;
}
- this.workerSet.clear();
}
/** @inheritDoc */
}
/** @inheritDoc */