Queue close does not close connections if it is called when is redis offline [BUG]
Created by: misos1
Description
Seems when is redis offline then bull is trying to reconnect and in this state queues cannot be closed. When is queue closing it should cancel reconnecting. Also seems if are queues created when is redis offline they will never actually connect after is redis run.
Minimal, Working Test code to reproduce the issue.
let Queue = require("bull");
let queue = new Queue("queue");
queue.process(_job => console.log("started"));
queue.on("error", err => console.log("queue error:", err));
queue.close();
When is redis running this test code gracefully ends. When is redis not running then this will emit bunch of errors and never ends even after I run redis again:
queue error: Error: connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) {
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 6379
}
I also tried to run it without queue.close
while was redis running, then turn off redis and call queue.close
and then turn on redis again and it does not closes.
When I try to run queues, then turn off redis it will print error messages, then turn on redis again and call queue.close
it will gracefully end.
Bull version
3.10.0