-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Closed
Labels
Description
Laravel Version
11.20.0
PHP Version
8.3.9
Database Driver & Version
No response
Description
When pushing an array of jobs onto the database queue using the bulk method the JobQueueing and JobQueued events are not triggered.
In contrast, when pushing an array of jobs onto the redis queue or the SQS queue using the bulk method, these event are triggered (as they should be imho).
I think that @RuslanMelnychenko also described symptoms of this bug in #52380.
I see two potential solutions:
- Either not inserting all jobs in a single database modification (i.e. using the default implementation of the bulk method)
- Or by calling the raiseJobQueueingEvent/raiseJobQueuedEvent methods for all jobs before/after the logic that is currently implemented in the bulk method.
Steps To Reproduce
Add a listener for JobQueueing and dispatch jobs onto different queues:
Bus::batch($jobs)->onConnection('database')->dispatch();
Bus::batch($jobs)->onConnection('redis')->dispatch();
The listener will not be invoked when using the database connection, while it will be invoked for the redis connection.
RuslanMelnychenko, thiago-you and dxnter