With commandTimeout option set, active timers are not cleared on client disconnection
With the commandTimeout option set, a timer is set up here: https://github.com/luin/ioredis/blob/eabb70ed835828ad85b602a217992486e05d2218/lib/Command.ts#L292-L300
the only place this timer gets cleared is here:
and that only gets called on successful resolution of the command...
The result is that if the client is disconnected while there is an active command timeout, there ends up being an orphaned timer in the nodejs process. In my case, this is causing tests and lambda executions to hang until the timer clears.
Possible simple fix is just to clear the timer on promise rejection too, here? I'm not familiar enough with the codebase to know if this is right though. If a maintainer could confirm this is a good idea, I can open a PR to implement:
Source: redis/ioredis