如何在Redis上的Laravel队列中获取所有待处理的作业? [英] How to get all pending jobs in laravel queue on redis?

查看:452
本文介绍了如何在Redis上的Laravel队列中获取所有待处理的作业?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

队列侦听器未在服务器上启动,某些作业已推送(使用Redis驱动程序).

Queue listener was not started on a server, some jobs where pushed (using Redis driver).

我该如何计算(或获得全部)这些论文工作?我没有找到任何工匠命令来获取此信息.

How could I count (or get all) theses jobs ? I did not found any artisan command to get this information.

推荐答案

如果有人仍然在这里寻找答案,这就是我的方法:

If someone still looking for an answer here is the way I do it:

$connection = null;
$default = 'default';

//For the delayed jobs
var_dump( \Queue::getRedis()->connection($connection)->zrange('queues:'.$default.':delayed' ,0, -1) );

//For the reserved jobs
var_dump( \Queue::getRedis()->connection($connection)->zrange('queues:'.$default.':reserved' ,0, -1) );

$connection是Redis连接名称,默认情况下为空,而$queue是队列/管道的名称,默认情况下为默认"!

$connection is the Redis connection name which is null by default, and The $queue is the name of the queue / tube which is 'default' by default!

这篇关于如何在Redis上的Laravel队列中获取所有待处理的作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆