I would like to highlight two important points in this PR:
When shutting down the Redis clients, we need to use the client.quit() method for graceful shutdown.
Before this PR, the code used client.end() which forcibly closed the connection, leading to potentially lost commands. Furthermore, this signature is now deprecated in the latest version of node-redis, client.end(flush) now takes a boolean to specify whether to flush pending commands. More info about it here.
The following snippet throws a Redis exception:
var job = Queue
.createJob('every', data)
.attempts(3)
.backoff(backoff)
.priority('normal');
//schedule it to run every 2 seconds
Queue.every('2 seconds', job);
// At this level, there are several undefined attributes on the job instance,
// such as job.id and job.zid.
// These attributes are used by the underlying Kue module when issuing zrem commands,
// leading to a malformed command
Queue.remove(job, function () {});
This is the reason why I rewrote the specs to remove the job by its unique key. We should probably open a separate issue for this.
I would like to highlight two important points in this PR:
client.quit()
method for graceful shutdown. Before this PR, the code usedclient.end()
which forcibly closed the connection, leading to potentially lost commands. Furthermore, this signature is now deprecated in the latest version of node-redis,client.end(flush)
now takes a boolean to specify whether to flush pending commands. More info about it here.This is the reason why I rewrote the specs to remove the job by its unique key. We should probably open a separate issue for this.