Here is my controller action:
public function export() {
(new ItemsExport)->queue('items.xlsx')->chain([
new ExportItemsEmail(auth()->user()),
]);
return redirect()->back()->with('success', 'File will be emailed to you once done.');
}
Super simple, we queue up the export (there are over 5k records, can be more)
class ItemsExport implements FromQuery, ShouldQueue {
use Exportable;
public function query() {
return Item::query();
}
}
Again nothing fancy.
Issue: Horizon fails
I get this error in horizon:
Illuminate\Queue\MaxAttemptsExceededException: Maatwebsite\Excel\Jobs\AppendQueryToSheet has been attempted too many times or run too long. The job may have previously timed out. in /home/adam/Documents/flare/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:736
From the docs this is suppose to chunk it and spin up many jobs. How ever in Horizon I see 2-3 jobs go through pending like no tomorrow, then one that stays before dying because of the above error.
Am I doing this wrong?