CSV import job is not executed
I've made an importer:
Now i added this import button to a relationmanager (Invitee)
When clicking the button, the modal appears, i can map my fields and then i get the noficiation that the Job is running on the background.
I have my queue_driver on SYNC, so that it should run directly.
After digging a little deeper, i found the trait that dispatches the job and sends the notification to the database.
$importChunkIterator = new ChunkIterator($csvResults->getRecords(), chunkSize: $action->getChunkSize()); /** @var array<array<array<string, string>>> $importChunks */ $importChunks = $importChunkIterator->get(); $job = $action->getJob(); $options = array_merge( $action->getOptions(), Arr::except($data, ['file', 'columnMap']), ); $importJobs = collect($importChunks) ->map(fn (array $importChunk): object => new ($job)( $import, rows: $importChunk, columnMap: $data['columnMap'], options: $options, )); Bus::batch($importJobs->all()) is always empty for some reason. The imports table in the database recieves the records, they are there. I'm not sure where to look now. Any idea's?
$importChunkIterator = new ChunkIterator($csvResults->getRecords(), chunkSize: $action->getChunkSize()); /** @var array<array<array<string, string>>> $importChunks */ $importChunks = $importChunkIterator->get(); $job = $action->getJob(); $options = array_merge( $action->getOptions(), Arr::except($data, ['file', 'columnMap']), ); $importJobs = collect($importChunks) ->map(fn (array $importChunk): object => new ($job)( $import, rows: $importChunk, columnMap: $data['columnMap'], options: $options, )); Bus::batch($importJobs->all()) is always empty for some reason. The imports table in the database recieves the records, they are there. I'm not sure where to look now. Any idea's?
14 Replies
the method in the trait recieves the data, its the correct file and mapping
Do you have the worker running in the background...
no, i have the queue driver on sync
it's not fetching any jobs to dispatch
Still haven't been able to figure this one out π¦
added some dd's in that trait:
Not sure but i find the $importChunks dd() output a bit strange
that returns this
how do you get that to work?
Having same issue, DB shows always pending, not sure what worker I need to start and where
php artisan queue:work
is it even possible to bypass the queue and just have direct call to the importer?
Documentation isn't saying anything about that
yea
if you ahve the queue_driver on sync it should do it directly
but that doesnt work for me either with the imports π
I can't find the queue_driver
add it to your env file
QUEUE_DRIVER=sync
or you can change it in config/queue.php
it should resort to sync by default
thanks!
well, it seems it already was in sync... yet that never worked.
Another weird thing is,
php artisan queue:work
worked initially for me, then I deleted all records in the queue and created new ones, but now it doesn't recognize the new jobs and doesn't fire anymorei have no problems running other jobs tho, its just the csv imports that dont work
ill try it with a fresh install this weekend, ill let you know if i find something