How to get all pending jobs in laravel queue on redis?

后端 未结 7 958
抹茶落季
抹茶落季 2020-12-13 10:06

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 co

7条回答
  •  遥遥无期
    2020-12-13 10:35

    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 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!

提交回复
热议问题