I am trying to read multiple IPFS files, to do some benchmarking, like this :
for(i=0;i<100;i++) {
const cid = cids[i]
for await (const chunk of ipfs.cat(cid)) {
//...
}
}
It throws a MaxListenersExceededWarning when i=10 and I imagine this is due to the ipfs.cat opens too many sockets.
What would be the right way to read IPFS files sequentially or to make this limit higher ? thanks
By googling âMaxListenersExceededWarning setMaxListenersâ and also the fact that youâre saying the 11th one is the problem, it implies somewhere in the code thereâs an EventEmitter that needs âsetMaxListenersâ called to allow more than 10. But I really donât know what Iâm talking about⌠I just did some googlinâ.
Not a limitation of the web browser, as this code runs in node.js
Iâve googled it too, and have found the same answer, but the setMaxListeners is not available in ipfs.
I am surprised also because this happens only on one computer on not on another⌠with the very same ipfs version (0.8.0). I will try to understand this better, and post my results here.
It would just take a minute or two to download the entire JS implementation of IPFS (as the github zip file) just so you can search if for the word âEventEmitterâ, just so you can see where and how they use it. Lots of times I can figure out workarounds or âroot causesâ by doing that kind of thing, even thought it might even be a programming language I donât even know sometimes! Good luck.