got-fetch
got-fetch copied to clipboard
Memory Leak from cache option in got
By default got-fetch
adds a simple Map
cache to the got
options which is currently buggy in got
.
Perhaps we could provide a way to turn the cache option off until it is fixed.
Related to https://github.com/sindresorhus/got/issues/1128 https://github.com/sindresorhus/got/issues/1523
import {fetch} from 'got-fetch';
let response = await fetch('https://www.youtube.com');
for (let i = 0; i < 1000; i++) {
response = await fetch('https://www.youtube.com');
}
// (node:40746) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [Keyv].
// Use emitter.setMaxListeners() to increase limit
// (Use `node --trace-warnings ...` to show where the warning was created)
https://github.com/sindresorhus/got/issues/1523#issuecomment-726065795