Do exporters not queue a job by default?
BookingsExportAction::make()
->label('Export Bookings')
->modalHeading('Export Bookings')
->modalDescription('Export list of bookings and the related user data to a CSV file.')
->exporter(BookingsExporter::class)
->hidden(User::userIsAdminOnlyAndNotSuperAdmin(auth()->user()))
->color('primary'),
BookingsExportAction::make()
->label('Export Bookings')
->modalHeading('Export Bookings')
->modalDescription('Export list of bookings and the related user data to a CSV file.')
->exporter(BookingsExporter::class)
->hidden(User::userIsAdminOnlyAndNotSuperAdmin(auth()->user()))
->color('primary'),
1 Reply
Right, part issue fixed, part not.
If I pass the records, I get the memory exhausted issue
Bus::chain([
Bus::batch([app($job, [
'export' => $export,
'query' => $serializedQuery,
'columnMap' => $columnMap,
'options' => $options,
'chunkSize' => $action->getChunkSize(),
'records' => $records->toArray(),
])])
->when(
filled($jobQueue),
fn (PendingBatch $batch) => $batch->onQueue($jobQueue),
)
->when(
filled($jobConnection),
fn (PendingBatch $batch) => $batch->onConnection($jobConnection),
)
->when(
filled($jobBatchName),
fn (PendingBatch $batch) => $batch->name($jobBatchName),
)
->allowFailures(),
...(($hasXlsx && (! $hasCsv)) ? [$makeCreateXlsxFileJob()] : []),
app(ExportCompletion::class, [
'export' => $export,
'columnMap' => $columnMap,
'formats' => $formats,
'options' => $options,
]),
...(($hasXlsx && $hasCsv) ? [$makeCreateXlsxFileJob()] : []),
])
->when(
filled($jobQueue),
fn (PendingChain $chain) => $chain->onQueue($jobQueue),
)
->when(
filled($jobConnection),
fn (PendingChain $chain) => $chain->onConnection($jobConnection),
)
->dispatch();
Bus::chain([
Bus::batch([app($job, [
'export' => $export,
'query' => $serializedQuery,
'columnMap' => $columnMap,
'options' => $options,
'chunkSize' => $action->getChunkSize(),
'records' => $records->toArray(),
])])
->when(
filled($jobQueue),
fn (PendingBatch $batch) => $batch->onQueue($jobQueue),
)
->when(
filled($jobConnection),
fn (PendingBatch $batch) => $batch->onConnection($jobConnection),
)
->when(
filled($jobBatchName),
fn (PendingBatch $batch) => $batch->name($jobBatchName),
)
->allowFailures(),
...(($hasXlsx && (! $hasCsv)) ? [$makeCreateXlsxFileJob()] : []),
app(ExportCompletion::class, [
'export' => $export,
'columnMap' => $columnMap,
'formats' => $formats,
'options' => $options,
]),
...(($hasXlsx && $hasCsv) ? [$makeCreateXlsxFileJob()] : []),
])
->when(
filled($jobQueue),
fn (PendingChain $chain) => $chain->onQueue($jobQueue),
)
->when(
filled($jobConnection),
fn (PendingChain $chain) => $chain->onConnection($jobConnection),
)
->dispatch();