v7.0.4
connectionOptions.scanCount (#330)
Allows the setting of connectionOptions.scanCount
to increase the number of keys scanned by each iteration of connection.getKeys
. On large datasets, this will improve the performance of queue.allDelayed()
, queue.locks()
, queue.stats()
and even scheduler polling can get very slow, taking over 30 seconds. This is because redis.scan()
gets invoked hundreds of thousands of times when connection.getKeys()
gets called. connection.getKeys()
uses the SCAN
command in Redis. When using SCAN
, the COUNT
parameter is set to 10 by default.
const connectionDetails = {
host: "127.0.0.1",
password: null,
port: 6379,
database: 0
scanCount: 1000 // <-- New!
};
const queue = new Queue({ connection: connectionDetails }, jobs);
await queue.connect();
await queue.stats()