bull将所有运行时数据存储到redis的数据解构中,使用redis事务和脚本来操作数据,保证操作的原子性
前缀
每个队列拥有不同的key前缀,用于区分特定于队列的数据
this.keyPrefix = opts.redis.keyPrefix || opts.prefix || 'bull'; // 默认key前缀是bull
delete opts.redis.keyPrefix; // 移除 ioredis 客户端的key前缀
Queue.prototype.toKey = function(queueType) {
return [this.keyPrefix, this.name, queueType].join(':');
};
const keys = {};
_.each(
[
'',
'active',
'wait',
'waiting',
'paused',
'resumed',
'meta-paused',
'active',
'id',
'delayed',
'priority',
'stalled-check',