Skip to content

[12.x] Fix scheduler errors by adding exitCode for tasks running in background #55605

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

tarkis
Copy link
Contributor

@tarkis tarkis commented Apr 30, 2025

This PR sets exitCode for all scheduled tasks.

PR #55572 added new exception if exitCode != 0. For some reason exitCode was not set for scheduled tasks that had runInBackground set to true.

@achrafAa
Copy link
Contributor

tested this and works correctly, nice fix @tarkis.

@AhmedAlaa4611
Copy link
Contributor

Can you add tests for this to ensure that we will not break it in future updates?

@alexey-m-ukolov
Copy link

alexey-m-ukolov commented Apr 30, 2025

Just curious: doesn't it constitute a breaking change, since finish() is public and it's signature is changed?
Maybe the second argument should be left as is for now? Unused argument is better then a breaking change imo.

But maybe this class is considered internal and can be changed at will?

@tarkis
Copy link
Contributor Author

tarkis commented Apr 30, 2025

Just curious: doesn't it constitute a breaking change, since finish() is public and it's signature is changed. May be the second argument should be left as is for now? Unused argument is better then a breaking change imo.

But maybe this class considered internal and can be change at will?

You are right! There was one hidden command schedule:finish https://github.com/laravel/framework/blob/12.x/src/Illuminate/Console/Scheduling/ScheduleFinishCommand.php#L46 that calls $event->finish()

Sent an updated commit to rollback that 2nd argument.

@taylorotwell
Copy link
Member

That PR was reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants