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',
'completed',
'failed',
'stalled',
'repeat',
'limiter',
'drained',
'progress'
],
key => {
ke
本文深入探讨了Bull任务队列如何利用Redis进行数据存储,包括前缀设定、队列管理、Job数据结构、锁机制以及元数据的存储方式,确保操作的原子性和数据的有效组织。
订阅专栏 解锁全文
578

被折叠的 条评论
为什么被折叠?



