When processing a job batch, when it goes to the next job and finishes it is throwing a reflection exception. You can find my exception details on Flare.
I’ve seen other posts about Reflection exceptions, so I’ve tried
- Restarting valet
composer update
composer dump-autoload
My job is dispatched using the following code:
$batch = Bus::batch( $this->sisProvider() ->syncSchools() ->filter(fn (School $school) => $school->active) ->map(fn (School $school) => SyncSchool::dispatch($school)) )->then(function (Batch $batch) { $this->notifySyncEmails(TenantSyncComplete::class); })->catch(function (Batch $batch, Throwable $ex) { $this->notifySyncEmails(TenantSyncFailed::class); })->finally(function (Batch $batch) { $this->update(['batch_id' => null]); })->name('Tenant SIS Sync')->dispatch();
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
The problem was how the batch was built. Calling SyncSchool::dispatch($school)
dispatches that job independently and returns a PendingDispatch
. So a PendingDispatch
was put in the batch, not my desired SyncSchool
job.
Changing SyncSchool::dispatch($school)
in my map to new SyncSchool($school)
correctly puts the SyncSchool
job in the batch.
Lesson: read the docs closely.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0