When call queue.close() bull throws Error: Connection is closed.
Created by: mseld
Description
Handling Graceful Shutdown Bull throws Error after call queue.close()
Test code to reproduce
// just Press CTRL+C after 1 min while component processing messages
const Queue = require('bull');
let queue = ('mail-queue', 'redis://127.0.0.1:6379');
queue.process(function (job, done) {
// code ...
});
process.on('SIGINT', function () {
setTimeout(() => {
queue.close();
}, 3000);
});
process.on('SIGTERM', function onSigterm() {
setTimeout(() => {
queue.close();
}, 3000);
});
Bull version
3.3.7&8
Additional information
Error: Connection is closed. at Redis.sendCommand (/folders/exe/hlr_charging/node_modules/ioredis/lib/redis.js:558:20) at Redis.zrevrange (/folders/exe/hlr_charging/node_modules/ioredis/lib/commander.js:131:17) at /folders/exe/hlr_charging/node_modules/bull/lib/getters.js:135:76 at /folders/exe/hlr_charging/node_modules/bull/lib/getters.js:26:18 at arrayMap (/folders/exe/hlr_charging/node_modules/lodash/lodash.js:660:23) at Function.map (/folders/exe/hlr_charging/node_modules/lodash/lodash.js:9571:14) at Queue._commandByType (/folders/exe/hlr_charging/node_modules/bull/lib/getters.js:16:14) at Queue.getRanges (/folders/exe/hlr_charging/node_modules/bull/lib/getters.js:124:30) at Queue.getJobs (/folders/exe/hlr_charging/node_modules/bull/lib/getters.js:146:17) at Queue.getFailed (/folders/exe/hlr_charging/node_modules/bull/lib/getters.js:115:17) at Timeout._onTimeout (/folders/exe/hlr_charging/index.js:83:11) at ontimeout (timers.js:386:11) at tryOnTimeout (timers.js:250:5) at Timer.listOnTimeout (timers.js:214:5)