Hello I've been experiencing some issues when updating to ioredis 5.8.0 or higher. My guess is that there is a problem in the subscription logic that was introduced there.
I'm running a Nextjs setup in which I do the following:
- In the nextjs instrumentation hook (which gets called once when a server is instantiated) I first initialise a ioredis client. The import of the ioredis client is dynamic as the instrumentation hook runs both in edge and nodejs runtimes. We only want to import the client in nodejs runtimes, importing it dynamically will make sure that the edge runtime never gets the code.
- The instance then gets put on a globalThis namespace (only when running in a nodejs runtime) to make sure it is available throughout the application.
Directly when starting the application it will show MaxListenersExceededWarning's, our monitoring showed it was opening an enormous amount of connections. (58k).
I have created a simple reproduction of this issue here
