@myvillage/cli 1.88.2 → 1.88.3
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/package.json
CHANGED
|
@@ -284,10 +284,17 @@ async function reconcileOnce(ctx) {
|
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
+
// The signal here lives as long as the runner does, so the abort listener must
|
|
288
|
+
// be removed when the timer wins. Leaving it attached leaked one listener per
|
|
289
|
+
// loop (~4k/day at a 20s interval) and tripped MaxListenersExceededWarning.
|
|
287
290
|
function sleep(ms, signal) {
|
|
288
291
|
return new Promise((resolve) => {
|
|
289
|
-
const
|
|
290
|
-
|
|
292
|
+
const onAbort = () => { clearTimeout(t); resolve(); };
|
|
293
|
+
const t = setTimeout(() => {
|
|
294
|
+
if (signal) signal.removeEventListener('abort', onAbort);
|
|
295
|
+
resolve();
|
|
296
|
+
}, ms);
|
|
297
|
+
if (signal) signal.addEventListener('abort', onAbort, { once: true });
|
|
291
298
|
});
|
|
292
299
|
}
|
|
293
300
|
|