saico 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/itask.js +6 -2
- package/package.json +1 -1
package/itask.js
CHANGED
|
@@ -294,11 +294,13 @@ Itask.prototype._run = async function _run(){
|
|
|
294
294
|
c._oncomplete.push(() => resolve());
|
|
295
295
|
}
|
|
296
296
|
}));
|
|
297
|
-
|
|
297
|
+
let timer;
|
|
298
|
+
const timeout = new Promise((resolve) => timer = setTimeout(() => {
|
|
298
299
|
_ldbg(`[ITASK ${this.name}] Timeout waiting for children after ${timeoutMs}ms, forcing completion`);
|
|
299
300
|
resolve();
|
|
300
301
|
}, timeoutMs));
|
|
301
302
|
await Promise.race([Promise.all(childPromises), timeout]);
|
|
303
|
+
clearTimeout(timer);
|
|
302
304
|
} catch (e) { lerr.perr(e); }
|
|
303
305
|
_ldbg(`[ITASK ${this.name}] Done waiting for children`);
|
|
304
306
|
}
|
|
@@ -438,12 +440,14 @@ Itask.prototype._ecancel = function _ecancel(arg){
|
|
|
438
440
|
c._oncomplete.push(() => resolve());
|
|
439
441
|
}
|
|
440
442
|
}));
|
|
441
|
-
|
|
443
|
+
let timer;
|
|
444
|
+
const timeout = new Promise((resolve) => timer = setTimeout(() => {
|
|
442
445
|
_ldbg(`[ITASK ${this.name}] Timeout waiting for children after ${timeoutMs}ms, `+
|
|
443
446
|
`forcing completion`);
|
|
444
447
|
resolve();
|
|
445
448
|
}, timeoutMs));
|
|
446
449
|
await Promise.race([Promise.all(childPromises), timeout]);
|
|
450
|
+
clearTimeout(timer);
|
|
447
451
|
} catch (e) { lerr.perr(e); }
|
|
448
452
|
_ldbg(`[ITASK ${this.name}] Done waiting for children`);
|
|
449
453
|
}
|