You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a client is created using lazyConnect, then a connect() is required and it works fine.
However, when a disconnect() is called, a new connect() is not allowed anymore.
Creating client...
client.connected: false
Attempt #1
connecting...
After connect(): client.connected: true
disconnecting...
After disconnect(): client.connected: true
Attempt #2
connecting...
Error: Redis is already connecting/connected
at RedisMock.connect (/tmp/ioredis/node_modules/ioredis-mock/lib/index.js:2220:11)
at safelyExecuteCommand (/tmp/ioredis/node_modules/ioredis-mock/lib/index.js:1713:16)
at /tmp/ioredis/node_modules/ioredis-mock/lib/index.js:1721:192
at new Promise (<anonymous>)
at RedisMock.connect (/tmp/ioredis/node_modules/ioredis-mock/lib/index.js:1721:159)
at session (/tmp/ioredis/test.js:16:18)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Solution
Perhaps I'm being too simplistic, but it seems the solution is updating the connected property to false on the disconnect() method.
The text was updated successfully, but these errors were encountered:
When a client is created using
lazyConnect
, then aconnect()
is required and it works fine.However, when a
disconnect()
is called, a newconnect()
is not allowed anymore.Let's consider the following example:
The output is:
Solution
Perhaps I'm being too simplistic, but it seems the solution is updating the
connected
property tofalse
on thedisconnect()
method.The text was updated successfully, but these errors were encountered: