From: Jérôme Benoit Date: Sun, 2 May 2021 16:33:35 +0000 (+0200) Subject: Check for threadId worker attribute only X-Git-Tag: v1.0.1-0~44 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=81696bd5662abd04013423cbe9427d2643c7ae25;p=e-mobility-charging-stations-simulator.git Check for threadId worker attribute only Signed-off-by: Jérôme Benoit --- diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 25ac7634..b975d0a4 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -130,7 +130,7 @@ export default class Utils { return JSON.parse(JSON.stringify(object)) as T; } - static isIterable(obj): boolean { + static isIterable(obj: T): boolean { if (obj) { return typeof obj[Symbol.iterator] === 'function'; } diff --git a/src/worker/WorkerSet.ts b/src/worker/WorkerSet.ts index 0e6855f1..dd12fdb5 100644 --- a/src/worker/WorkerSet.ts +++ b/src/worker/WorkerSet.ts @@ -98,7 +98,7 @@ export default class WorkerSet extends WorkerAbstract { private getWorkerSetElementByWorker(worker: Worker): WorkerSetElement { let workerSetElt: WorkerSetElement; this.workerSet.forEach((workerSetElement) => { - if (JSON.stringify(workerSetElement.worker) === JSON.stringify(worker)) { + if (workerSetElement.worker.threadId === worker.threadId) { workerSetElt = workerSetElement; } });