vendredi 23 août 2019

Parallel commands in Laravel 5 Scheduler

Okay, so after a bit of research online I've found that with Laravel 5 you can now use a function called runInBackground() so you can have your other commands run immediately?

I've put together a little bit of code within my Kernel file but it appears my commands aren't running?

protected $commands = [
    Commands\Run::class
];

/*
 * Define the application's command schedule.
 *
 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 * @return void
*/
protected function schedule(Schedule $schedule)
{
    $accounts = Accounts::where('status', '1')->where('in_use', '0');
    foreach($accounts as $account) {
        $schedule->command('run:cron '.$account->id)->everyMinute()->runInBackground();
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire