Skip to content

Comments

[12.x] add BatchFinished event#58431

Merged
taylorotwell merged 6 commits intolaravel:12.xfrom
jackbayliss:12.x-batch-finished-event
Jan 20, 2026
Merged

[12.x] add BatchFinished event#58431
taylorotwell merged 6 commits intolaravel:12.xfrom
jackbayliss:12.x-batch-finished-event

Conversation

@jackbayliss
Copy link
Contributor

@jackbayliss jackbayliss commented Jan 19, 2026

So, we have a BatchDispatched event, which we can hook into to find out when a batch was dispatched...

It would be nice to have a BatchFinished event too- that way we don't need to poll or even look at the DB to find out when its finished, and we can make it available for metrics / logging etc.

Why not just use the finally() callback?

Cause you have to remember to add it every time you create a batch, and if you're an infra man you just wanna see the metrics!

With this event you can listen for it globally and handle all batch completions in one place useful for logging, metrics, notifications etc.

Not sure if it's a 100% great fit in the Batch class, but didn't want to go into the repositories - so this seems to fit in with some other places.

Happy to move to 13.x if you deem risky 🫡

@github-actions
Copy link

Thanks for submitting a PR!

Note that draft PR's are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@jackbayliss
Copy link
Contributor Author

jackbayliss commented Jan 19, 2026

Failing test is PHP Stan freaking out about the ComponentTagCompiler.. same on main, so not related.

@jackbayliss jackbayliss marked this pull request as ready for review January 19, 2026 23:15
@taylorotwell taylorotwell merged commit 5348504 into laravel:12.x Jan 20, 2026
69 of 70 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