When using simple cache adapters MaxListenersExceededWarning is emitted. This has previously been investigated in #792 and #1128 but either it is a regression or did not account for highly asynchronous environments with 100's of parallel requests.
Unsure if this is best opened in either keyv or cacheable-request, but given it was declared solved in #1128 I've opened it here first.
Environment Info:
System:
OS: macOS 10.15.7
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 12.19.0 - ~/.nvm/versions/node/v12.19.0/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v12.19.0/bin/npm
Browsers:
Chrome: 86.0.4240.198
Safari: 14.0
Got: 11.8.0
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [Keyv]. Use emitter.setMaxListeners() to increase limit
const got = require('got');
const client = got.extend({
cache: {
get: (key) => {
return undefined;
},
set: (key, value) => {
}
}
});
(async () => {
const promises = [];
for (let i = 0; i < 20; i++) {
promises.push(client('https://www.google.com', { method: 'HEAD' }));
};
await Promise.all(promises);
console.log('Done');
})();
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too