Laravel 5 - Task schedule withoutOverlapping not working

前端 未结 4 2116
予麋鹿
予麋鹿 2021-02-20 05:33

I try to run schedule on Laravel 5. Its work fine when I run this:

$schedule->call(function() {
   // do something here..
})->everyMinute();
4条回答
  •  粉色の甜心
    2021-02-20 05:50

    The order is important, but it was never mentioned.

    Try this

    $schedule->call(function () {
       // do something here..
    })->name('job_name')->withoutOverlapping()->everyMinute();
    

    This is how it worked for me:

    (1) call -> (2) name -> (3) withoutOverlapping -> (4) dailyAt -> (5) onOneServer

    when you mess around with the order you can get errors like

    A scheduled event name is required to prevent overlapping. Use the name method before 'withoutOverlapping'.

    or

    Call to undefined method Illuminate\Console\Scheduling\Schedule::name()

提交回复
热议问题