Skip to content

Conversation

@jfBiswajit
Copy link

When Bus::batch([]) is called with an empty array, the then() and finally() callbacks were not being executed. This was counterintuitive as batches with zero jobs should logically complete immediately and trigger their completion callbacks.

This change detects when no jobs are added to a batch and immediately marks it as finished, executing the registered then() and finally() callbacks.

Fixes #58163

When Bus::batch([]) is called with an empty array, the then() and
finally() callbacks were not being executed. This was counterintuitive
as batches with zero jobs should logically complete immediately and
trigger their completion callbacks.

This change detects when no jobs are added to a batch and immediately
marks it as finished, executing the registered then() and finally()
callbacks.

Fixes laravel#58163
@taylorotwell
Copy link
Member

Slight breaking change.

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.

Empty Bus::batch([]) doesnt call callbacks

2 participants