plug-leaking-promise-race
Installation
SKILL.md
plug-leaking-promise-race
Never re-race the same pool of promises across loop iterations. Each call to Promise.race([A, B, …]) attaches fresh .then handlers to every arm. A promise that survives N iterations accumulates N handler sets. See nodejs/node#17469 and @watchable/unpromise.
Patterns
-
Safe — both arms created per call:
const value = await Promise.race([ fetchSomething(), new Promise((_, r) => setTimeout(() => r(new Error('timeout')), 5000)), ]) -
Leaky —
poolsurvives across iterations, accumulating handlers: