Laravel Unscheduled Scheduled Job Fails

I have a Laravel Scheduled job that is defined Kernel.phpas

$schedule->call('\App\Http\Controllers\ScheduleController@processQueuedMessages')
    ->everyFiveMinutes()
    ->name('process_queued_messages')
    ->withoutOverlapping();

During development, my work threw an exception due to a syntax error. I fixed the error and tried to execute it again; but for some reason it will not.

I tried artisan downand then artisan up. I also tried restarting the server instance. But nothing would help. The work simply did not work (there was no exception either).

I understand what the problem is with ->withoutOverlapping(). One way or another, the Laravel scheduler believes that the work is already running and therefore does not execute it again.

+2
source share
5 answers

I found a solution by looking at the vendor code.

Illuminate\Console\Scheduling\CallbackEvent.php

schedule-*.

public function withoutOverlapping()
{
    if ( ! isset($this->description))
    {
        throw new LogicException(
            "A scheduled event name is required to prevent overlapping. Use the 'name' method before 'withoutOverlapping'."
        );
    }

    return $this->skip(function()
        {
            return file_exists($this->mutexPath());
        });
}

protected function mutexPath()
{
    return storage_path().'/framework/schedule-'.md5($this->description);
}

schedule-* storage/framework .

+5

, , - . - - , Overlapping .

Laravel -

, , " ". 24 :

- , Overlapping 24 . , 24 , . , :

$schedule->command('emails:send')->withoutOverlapping(10);//where 10 refers to minutes

+5

, , .

/ schedule-***********.

cron. withoutOverlapping() function.

, . , - .

+4

, , . . , /, ​​. withoutOverlapping(), , schedule- *, , , cron *, , /.

, , .

0

:

php artisan cache:clear
0

All Articles