Laravel 5 - Task schedule withoutOverlapping not working

前端 未结 4 2149
予麋鹿
予麋鹿 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 06:08

    The cron withoutOverlapping() is now working. Let's understand how it works
    
    For E.g:
    $schedule->command('command')
                        ->hourly()
                        ->withoutOverlapping();
    The withoutOverlapping means when cron runs then it will generate a lock file in storage/framework/ directory and once it's completed then it will delete the lock file. Now next time onwards, it will check weather the lock file is there or not. If lock file is there that means the previous cron is not completed and it will not allow the cron to overlap the previous one. 
    
    In this scenario, the lock file is there into the storage/framework/ directory so that the cron is not working
    
    **Lock file looks like:** schedule-random_string
    For E.g: schedule-0bfdb7f0bc14b27d84c7d6f2a2528e85b0847fc6
    
    **To Fix:** Remove or rename the lock file (storage/framework/schedule-0bfdb7f0bc14b27d84c7d6f2a2528e85b0847fc6)
    

提交回复
热议问题