Skip to content

Conversation

faisuc
Copy link

@faisuc faisuc commented Oct 9, 2025

Prevents Bus::chain(...)->catch(...) from being invoked twice when a Bus::batch(...) inside the chain fails on the sync queue. Batch catch runs once; chain catch runs once.

As described in #55077, nested batches inside chains on the sync queue caused:

  • Chain catch to run twice (once via injected batch catch, once via chain).
  • Batch catch to run inside a DB transaction, rolling back its side effects on sync.

@faisuc faisuc closed this Oct 9, 2025
@faisuc faisuc reopened this Oct 9, 2025
});
if ($queueConnection instanceof SyncQueue) {
$this->repository->transaction(function () use ($count) {
$this->repository->incrementTotalJobs($this->id, $count);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to be in a transaction here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, you’re right. It doesn’t need to be in a transaction on the sync path. We can’t group dispatch with DB work there anyway, and the increment is already a single atomic UPDATE. I’ve updated the PR to increment directly on sync and kept the transactional grouping for non-sync drivers.

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