Skip to content
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

Revert "[11.x] Name of job set by displayName() must be honoured by S… #51034

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

RobertBoes
Copy link
Contributor

#50973 introduces quite a significant breaking change imho. Job constructors shouldn't perform any work, however this PR now creates job instances for every single job defined in the scheduler.

For a cron that runs every minute and having a lot of scheduled jobs this means every single class is instantiated in memory. This is quite a memory increase for a small developer improvement.

@taylorotwell
Copy link
Member

Sorry - what is the breaking change?

@RobertBoes
Copy link
Contributor Author

Lets say you have this in your routes/console.php:

Schedule::job(Heartbeat::class)->everyFiveMinutes();

Prior to this change the Heartbeat job would only be instantiated when the schedule needs to run that job. With this change it will be instantiated every time, not only when running the scheduler, also when running artisan commands, for web requests etc.

So if your scheduler has lots of jobs scheduled like this those class will now all be instantiated in every single process, consuming memory only to optionally use the displayName method.

@taylorotwell taylorotwell merged commit d08a9b0 into laravel:11.x Apr 12, 2024
30 checks passed
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.

2 participants