Alternate Promise.race() implementation which doesn't leak memory, courtesy Brian Kim (https://github.com/brainkim)
npm install race-as-promisedThis module implements Promise.race() in a way that does not leak
memory.
The V8 Promise implementation does leak memory in many commonPromise.race([...]) call cases; see
e.g. https://github.com/nodejs/node/issues/17469.
The V8 Promise implementation is likely not going to be
fixed.
See also: https://bugs.chromium.org/p/v8/issues/detail?id=9858
``bash`
npm install race-as-promised
`js
const race = require ("race-as-promised");
// Use race([...]) instead of Promise.race([...])
``
The source code and test core have been made available under The
Unlicense
by Brian Kim, to whom we owe our gratitude.
An additional issue in the original code has been found and fixed by
Dan Bornstein, whose efforts are
likewise appreciated.