-
-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Package version
9.2.0
Describe the bug
Hi,
I've encountered a bug in tests, where i was unable to gracefully shutdown adonis. After some digging i found out, that when test timeout on some long waiting promise, japa will automatically fails after 2 seconds or so. After that the app will start to shutdown and finish the process before the promise will return, but the whole node proccess cant end, because it has still this hanging promise. This is expected behaviour and problem on our side. However once the promise is fulfilled and if in the callback chain is a call for redis, adonis/redis will reconnect to the redis again, but as the app is officially shutted down, so it will never be disconnected and this connection will result in process hanging indefinitely.
As adonis/redis is basically just a wrapper around ioredis for adonis, i believe it should check before trying to connect, whether the app is shutted down or not. Also i think you should respect lazyConnection argument in this process or Omit it from the config type at least, cause i spent hours figuring out, why the hell is the app still connecting to the redis, even though lazyConnection is turned off. 😄
You can reproduce it pretty easily in any adonis project using redis, when you run specific test and set for example some sleep promise for few seconds.
Thank you and have a nice day!
Reproduction repo
No response