Laravel第二个任务计划永远不会运行

时间:2017-11-24 11:55:38

标签: php laravel cron scheduled-tasks

我在共享主机上有cron条目:

* * * * * php web / artisan schedule:run

问题是 queue:work 命令无论顺序如何都有效,但更新视频视图的第二个任务(Closure)永远不会运行。

来自 Kernel.php的代码:

  /**
 * Define the application's command schedule.
 *
 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 * @return void
 */
protected function schedule(Schedule $schedule)
{

    //Each Video total_video_views will be accurately updated on daily basis.
    $schedule->call(function () {
       $videos = Video::get();
       app('queue')->pushOn('high', new UpdateVideoViews($videos));

    })->hourlyAt('30')
      ->name('updates all video views')
      ->withoutOverlapping();

    //this is alternative to supervisor since shared hosting someties doesnt provide supervisor
    //so we use cron instead to keep queue worker up
    $schedule->command('queue:work --queue=high,default')
        ->everyMinute()
        ->name('keeps queue worker active')
        ->withoutOverlapping();

}

有没有办法运行它?我的怀疑是队列:工作命令沿着"没有Oververpping()"有点可能阻止任何其他任务要处理。

0 个答案:

没有答案