Answer the question
In order to leave comments, you need to log in
Laravel infinite task scheduling?
There is a table, it has records, you need to go through each record in turn and execute the function, and so on in a circle.
How can this be done through Task Scheduling or can it be some other way?
Now I created a command and call it like this $schedule->command('command:start')->everyMinute();
In it, I work with one row of the table and then run the command with the next row, and so on in a circle. But this is not an efficient method, because the function is executed for 5 seconds, and the remaining 55 seconds are idle. How can it be done otherwise?
Answer the question
In order to leave comments, you need to log in
In the desired command, add an infinite loop and there is already logic in it.
while(true)
{
doWork();
sleep(1);
}
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php artisan command:start
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=forge
numprocs=8
redirect_stderr=true
stdout_logfile=/home/forge/app.com/worker.log
stopwaitsecs=3600
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question