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

[9.x] Remove duplicate queries to find batch #41121

Merged
merged 1 commit into from
Feb 21, 2022

Conversation

sebdesign
Copy link
Contributor

Everytime the Batchable::batch() method is called, a database query is performed using the DatabaseBatchRepository.

So when we are recording successful/failed jobs, first we fetch the batch to check if it's null, and then we fetch it again to record the job.

Since it's rendundant to fetch the batch two times from the database, this PR fetches the batch once, and if it exists, it will record the job.

@GrahamCampbell GrahamCampbell changed the title Remove duplicate queries to find batch [9.x] Remove duplicate queries to find batch Feb 19, 2022
@taylorotwell taylorotwell merged commit 502a505 into laravel:9.x Feb 21, 2022
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