Check for threadId worker attribute only
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 2 May 2021 16:33:35 +0000 (18:33 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 2 May 2021 16:33:35 +0000 (18:33 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/utils/Utils.ts
src/worker/WorkerSet.ts

index 25ac7634e28f3c4584d4fecda288be0de2f6387d..b975d0a46b30007b1212f0fc4299130284c183df 100644 (file)
@@ -130,7 +130,7 @@ export default class Utils {
     return JSON.parse(JSON.stringify(object)) as T;
   }
 
-  static isIterable(obj): boolean {
+  static isIterable<T>(obj: T): boolean {
     if (obj) {
       return typeof obj[Symbol.iterator] === 'function';
     }
index 0e6855f1887cf6f1d3563bf45b3a07b7e6d7f8b1..dd12fdb5a59ee1f118a5a6b2016451d2ea1f735b 100644 (file)
@@ -98,7 +98,7 @@ export default class WorkerSet<T> 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;
       }
     });