You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
You’re right—when pushing an array of jobs to the database queue with the bulk method, the JobQueueing and JobQueued events aren’t triggered. This is different from the behavior on Redis or SQS queues, which can definitely cause inconsistencies.
Possible Workaround
One option is to manually trigger these events in your code before and after the bulk dispatch. Here’s a quick example:
use Illuminate\Support\Facades\Event;
use Illuminate\Queue\Events\JobQueueing;
use Illuminate\Queue\Events\JobQueued;
$jobs = [ /* your array of jobs */ ];
foreach ($jobs as $job) {
Event::dispatch(new JobQueueing($job));
}
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:
Steps To Reproduce
Add a listener for JobQueueing and dispatch jobs onto different queues:
The listener will not be invoked when using the database connection, while it will be invoked for the redis connection.
The text was updated successfully, but these errors were encountered: