Skip to content

Conversation

@vadimonus
Copy link
Contributor

@vadimonus vadimonus commented Nov 1, 2025

Currently ChainedBatch do not use queue and connection of wrapped PendingBatch. When it creates new batch in src/Illuminate/Bus/ChainedBatch.php:86, connection and queue of original batch is lost.

Currenctly, if we have code

        Bus::chain([
            Bus::batch([
                new ProcessPodcast(1),
                new ProcessPodcast(2),
            ])->onQueue('other'),
            (new ProcessPodcast(3))->onQueue('other'),
        ])->dispatch();

Job 3 will be dispatched to queue other, but Jobs 1 and 2 will be dispatched to queue default, even it is explicitly defined to use other queue.

In this PR chainedBatch takes queue and connection from wrapped batch, so later, when converted back to pending batch, it has same queue and connection as before.

Example of tests failing before fix https://github.com/laravel/framework/actions/runs/19057979725

@vadimonus vadimonus marked this pull request as draft November 1, 2025 20:40
@vadimonus vadimonus force-pushed the chained-batch-keeps-queue branch 2 times, most recently from 4e63726 to 8382832 Compare November 1, 2025 21:03
@vadimonus vadimonus marked this pull request as ready for review November 1, 2025 21:20
@vadimonus vadimonus force-pushed the chained-batch-keeps-queue branch 2 times, most recently from 827fa10 to 6e17f54 Compare November 3, 2025 09:07
@vadimonus vadimonus force-pushed the chained-batch-keeps-queue branch from 6e17f54 to 0de6bb5 Compare November 4, 2025 04:32
@taylorotwell taylorotwell merged commit b556cbb into laravel:12.x Nov 4, 2025
52 of 66 checks passed
@vadimonus vadimonus deleted the chained-batch-keeps-queue branch November 4, 2025 17:33
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