参考flower源码
取队列名,发送到求数量的函数中
queue_names = ControlHandler.get_active_queue_names()
queues = yield broker.queues(queue_names)
queues函数:
SEP = 'x06x16'
DEFAULT_PRIORITY_STEPS = [0, 3, 6, 9]
def queues(self, names):
queue_stats = []
for name in names:
priority_names = [self._q_for_pri(name, pri) for pri in self.priority_steps]
queue_stats.append({
'name': name,
'messages': sum([self.redis.llen(x) for x in priority_names])
})
raise gen.Return(queue_stats)
最终为 redis_server.llen(队列名)
假设设置的一条队列名为 Default,那么在redis中的队列名为
['Default', 'Defaultx06x163', 'Defaultx06x166', 'Defaultx06x169']
llen计算一遍再加起来就好了。
但除了第一位,后面几位通常为0。
应该是优先级队列,待探究