Filament Exporter

When I run the command php artisan queue:work. the always keep running 2024-01-19 13:39:03 Illuminate\Bus\ChainedBatch .......................................................................................... RUNNING
ExportBulkAction::make()
->label('Export')
->icon('heroicon-o-arrow-down-tray')
->color('primary')
->modalHidden(true)
->chunkSize(10000)
->exporter(UserExporter::class),
ExportBulkAction::make()
->label('Export')
->icon('heroicon-o-arrow-down-tray')
->color('primary')
->modalHidden(true)
->chunkSize(10000)
->exporter(UserExporter::class),
13 Replies
toeknee
toeknee11mo ago
How many users do you have? Have you trying shrinking your chunksize?
Umar Farooq
Umar FarooqOP11mo ago
it's just 1000 but the query keep running like forever I also reduce the chunk size to 250
toeknee
toeknee11mo ago
try setting it to 2 at the moment you have it at 10,000
Umar Farooq
Umar FarooqOP11mo ago
the exports table running just 10 rows at a time?
No description
toeknee
toeknee11mo ago
Ok so it is running but not processing any rows
Umar Farooq
Umar FarooqOP11mo ago
yes no logs no error
toeknee
toeknee11mo ago
And you have run the queue worker
Umar Farooq
Umar FarooqOP11mo ago
yes
No description
toeknee
toeknee11mo ago
Wondering if you have an infinite loop within your UserExporter class
Dennis Koch
Dennis Koch11mo ago
successful_rows is 0, so that's probably why it's running in a loop
Umar Farooq
Umar FarooqOP11mo ago
<?php

namespace App\Filament\Exports;

use App\Models\User\User;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Jobs\PrepareCsvExport;
use Filament\Actions\Exports\Models\Export;

class UserExporter extends Exporter
{
protected static ?string $model = User::class;

public static function getColumns(): array
{
return [
ExportColumn::make('name'),
];
}

public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your user export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';

if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
}

return $body;
}
}
<?php

namespace App\Filament\Exports;

use App\Models\User\User;
use Filament\Actions\Exports\ExportColumn;
use Filament\Actions\Exports\Exporter;
use Filament\Actions\Exports\Jobs\PrepareCsvExport;
use Filament\Actions\Exports\Models\Export;

class UserExporter extends Exporter
{
protected static ?string $model = User::class;

public static function getColumns(): array
{
return [
ExportColumn::make('name'),
];
}

public static function getCompletedNotificationBody(Export $export): string
{
$body = 'Your user export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';

if ($failedRowsCount = $export->getFailedRowsCount()) {
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
}

return $body;
}
}
I don't know
Wannes
Wannes10mo ago
Hi, did you figure this out? Having the same problem
Umar Farooq
Umar FarooqOP10mo ago
No, I create custom export functionality
Want results from more Discord servers?
Add your server