Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

redis

laravel

The queue:listen was not run on a server, so some jobs were pushed (using Redis driver) but never run.

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

like image 808
rap-2-h Avatar asked Feb 15 '16 15:02

rap-2-h


People also ask

How do I check my Redis queue status?

If you are using redis driver for your queue, you can count all remaining jobs by name: use Redis; // List all keys with status (awaiting, reserved, delayed) Redis::keys('*'); // Count by name $queueName = 'default'; echo Redis::llen('queues:' . $queueName); // To count by status: echo Redis::zcount('queues:' .

How do I know if my Laravel queue is working?

Show activity on this post. This is lower level but in the same vein you could run a command such as ps -aux | grep queue to literally view the running queue processes on whatever server your application/queue workers are running on.

What is Redis queue Laravel?

Redis Queue is a python library for queueing purposes for background handling.


Video Answer


1 Answers

If someone is still looking for an answer, here is the way I did 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 $default is the name of the queue which is default by default.

like image 165
Torgheh Avatar answered Sep 21 '22 13:09

Torgheh