Answer the question
In order to leave comments, you need to log in
How to add only one task to laravel queue?
There are long tasks, from 2 to 30 minutes. It is necessary that the queue does not grow if there is already a task in the worker.
What do we have.
Kernel.php
$schedule->command('source')->withoutOverlapping()->everyMinute();
$count = Redis::lrange('queues:source', 0, -1);
if (count($count) == 0)
dispatch((new \App\Jobs\Source())->onConnection('redis')->onQueue('source'));
public function handle()
{
dump('job work');
sleep(2000);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question