Unexpected behavior with Batch callbacks with Queue #57795
-
|
Hi all 👋 I'm observing a behavior that is unexpected for me. Let's say I'm batching some jobs that I want to go to a queue other than the default, let's call this other queue "import". Bus::batch([
new MyJob,
])
->onQueue(Queue::Import)
->dispatch(); // dispatches to the "import" queueThis will successfully add the batch of jobs to the "import" queue as expected. However, if I chain a callback function in the batch, the jobs will instead go to the "default" queue. Bus::batch([
new MyJob,
new MyJob,
new MyJob,
])
->then(fn () => Log::info('finished MyJobs!'))
->onQueue(Queue::Import)
->dispatch(); // dispatches to the "default" queueI've noticed this problem also occurs with the I am on version 12.37.0 of the |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 19 replies
-
|
Can you please check in the batched table from DB the serialized options for both cases? |
Beta Was this translation helpful? Give feedback.
-
|
UPDATE. Disregard this. Look below. The problem was related to tinker. The issue is that the queue is not set on the event // \Illuminate\Broadcasting\BroadcastManager::queue
$queue = null;
if (method_exists($event, 'broadcastQueue')) {
$queue = $event->broadcastQueue();
} elseif (isset($event->broadcastQueue)) {
$queue = $event->broadcastQueue;
} elseif (isset($event->queue)) {
$queue = $event->queue;
}will not see the queue. |
Beta Was this translation helpful? Give feedback.
-
|
I think I'm getting somewhere on this. The issue has something to do with the serialization process of the For some reason the callback function is corrupts the serialized data. Because it's corrupted, the deserializing function is just returning an empty array ( It's worth pointing out that I've been running my I then went to look at the I believe this is what is corrupting the |
Beta Was this translation helpful? Give feedback.
-
|
Well, I've figured out that the
I think that pretty much concludes this adventure. I'm not sure if the Big thank you to @macropay-solutions for helping talk through the issue! 👏 |
Beta Was this translation helpful? Give feedback.






Well, I've figured out that the
laravel/serializable-closuredoesn't support the tinker REPL: https://github.com/laravel/serializable-closureI think that pretty much concludes this adventure. I'm not sure if the
Bus::batch(...)->then(...)->dispatch()should throw a warning or exception when in the tinker REPL...Big thank you to @macropay-solutions for helping talk through the issue! 👏