laravel / lumen-framework

The Laravel Lumen Framework.
https://lumen.laravel.com
MIT License
1.48k stars 416 forks source link

Kernel schedule runInBackground() is always running pingOnFailure() #1185

Closed cloetensbrecht closed 3 years ago

cloetensbrecht commented 3 years ago

Description:

When running a scheduled command with runInBackground, the pingOnFailure method is always fired. When you run the below code with php artisan schedule:run you will only see the before, but the pingOnFailure is fired too. When you remove the runInBackground it will fire the onSuccess which I gave a 404 header response to visually see the response in the console. When the runInBackground is added you don't receive the 500 response, but when testing it with a real service like https://healthchecks.io/ it receives the /failure call.

Steps To Reproduce:

protected function schedule(Schedule $schedule)
{
        $schedule
            ->command('-V')
            ->before(function() {
                echo 'before'.PHP_EOL;
            })
            ->after(function() {
                echo 'after'.PHP_EOL;
            })
            ->onSuccess(function () {
                echo 'success'.PHP_EOL;
            })
            ->onFailure(function () {
                echo 'failure'.PHP_EOL;
            })
            ->pingBefore('https://mock.codes/200')
            ->pingOnSuccess('https://mock.codes/404')
            ->pingOnFailure('https://mock.codes/500')
            ->runInBackground()
            ->everyMinute();
}
driesvints commented 3 years ago

Hey there,

Unfortunately we don't support this version anymore. Please check out our support policy on which versions we are currently supporting. Can you please try to upgrade to the latest version and see if your problem persists? If so, please open up a new issue and we'll help you out.

Thanks!