mercredi 28 novembre 2018

Scheduler runInBackground not working in laravel 5.4

I am working on a project where need to run CRON every hour and fetching lots of latest data for each time I run CRON and there are multiple user.

The CRON is taking time to complete for each user, so I am trying to run the CRON on background so that will not affect other crons too.

$users = User::where("connected", 1)->where("role_id", 2)->get();

foreach ($users as $user) {
    $schedule->command('fetch:product ' . $user->id)->cron('* */4 * * *');
    $schedule->command('fetch:report ' . $user->id)->hourly()->runInBackground();
}

From the above example first CRON is working but another one is not working because I have added ->runInBackground() function so that it work in background and I have enabled the log but log in showing only of first CRON not second CRON.

Code is currently on Windows Server later will be moved to Linux.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2TT2Gkk
via IFTTT

Aucun commentaire:

Enregistrer un commentaire