S
S
Sergey Sokolov2019-12-05 14:16:37
Redis
Sergey Sokolov, 2019-12-05 14:16:37

How do I find out how many tasks are in front of me in the Lumen/Laravel task queue in Redis?

The task queue is stored in Redis. Lumen / Laravel version 6.x
How can I find out from a task at any given time idhow many more tasks are ahead of it? Laravel did not find it
in the description of queues. At the moment of creating a task, you can read the size of the queue through RedisQueue.size() , but what about later, after a while? I look, when there are tasks in the queue, three keys appear:

"queues:xxxxxx.queue"          LIST
"queues:xxxxxx.queue:notify"   LIST 
"queues:xxxxxx.queue:reserved" ZSET

The first, it seems, stores just the tasks themselves, serialized, it seems, in JSON. You can search for idtasks in the items in this list. Crutch, but so far this is the main option.
The second key :notifystores only "1" with the same number as the first one.
The third :reservedone seems to store the currently running task.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2019-12-05
@Nc_Soft

You can find out through LLEN how many elements are in the queue at any time. If the queues in one thread are sequentially raked, then it is possible to calculate the position of the task knowing how much has been created / completed, but if not, then only poking around in the queues.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question