Laravel 5 - Task schedule withoutOverlapping not working
Delete ->everyMinute()
when using ->withoutOverlapping()
it will still run every minute but without overlapping.
UPDATE
Since Laravel v. 5.5+ you can specify on how many minutes must pass before the "without overlapping" lock expires.
eg. ->withoutOverlapping(10)
can be used to unlock the "overlapping" when 10 minutes will pass.
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()