I have table users that I need to load continuously, so after updating I would like to restart the command directly.
In fact, I use cron, which runs every minute with Laravel ( $schedule->command('update:users')->everyMinute();), but I lose some time if the work is faster than one minute. I will overload my server if it is more than one minute.
I thought I could use the queue, and as soon as the script exits, relauch itself, like this:
// Do My stuff
Queue::push(new UpdateUsers($));
But if the script crashes, it will not restart, and I need to run it at least once. I know that I could use the pcntl_fork function, but I would like to have a turnkey function with Laravel. How can I do it?
Kevin source
share