Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Rely on Laravel's default job retry settings for Imports/Exports #14856

Open
wants to merge 6 commits into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/actions/docs/07-prebuilt-actions/08-import.md
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ If you'd like to customize the middleware that is applied to jobs of a certain i

### Customizing the import job retries

By default, the import system will retry a job for 24 hours. This is to allow for temporary issues, such as the database being unavailable, to be resolved. That functionality is defined in the `getJobRetryUntil()` method on the importer class:
By default, the import system uses your application's default job retry functionality. However, if you want to customize this behavior for temporary issues, such as a database being unavailable, you can do so by defining the logic in the getJobRetryUntil() method on the importer class:

```php
use Carbon\CarbonInterface;
Expand Down
3 changes: 2 additions & 1 deletion packages/actions/docs/07-prebuilt-actions/09-export.md
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,8 @@ If you'd like to customize the middleware that is applied to jobs of a certain e

### Customizing the export job retries

By default, the export system will retry a job for 24 hours. This is to allow for temporary issues, such as the database being unavailable, to be resolved. That functionality is defined in the `getJobRetryUntil()` method on the exporter class:

By default, the export system uses your application's default job retry functionality. However, if you want to customize this behavior for temporary issues, such as a database being unavailable, you can do so by defining the logic in the getJobRetryUntil() method on the export class.

```php
use Carbon\CarbonInterface;
Expand Down
6 changes: 3 additions & 3 deletions packages/actions/resources/lang/id/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
'form' => [

'file' => [

'label' => 'Berkas',

'placeholder' => 'Unggah berkas CSV',

'rules' => [
'duplicate_columns' => '{0} Berkas tidak boleh memiliki lebih dari satu kolom header yang kosong.|{1,*} Berkas tidak boleh memiliki kolom header yang duplikat: :columns.',
],

],

'columns' => [
Expand Down
6 changes: 0 additions & 6 deletions packages/actions/src/Exports/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Filament\Actions\Exports;

use Carbon\CarbonInterface;
use Filament\Actions\Exports\Enums\ExportFormat;
use Filament\Actions\Exports\Models\Export;
use Filament\Forms\Components\Component;
Expand Down Expand Up @@ -88,11 +87,6 @@ public function getJobMiddleware(): array
];
}

public function getJobRetryUntil(): ?CarbonInterface
{
return now()->addDay();
}

/**
* @return array<int, string>
*/
Expand Down
6 changes: 5 additions & 1 deletion packages/actions/src/Exports/Jobs/ExportCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ public function handle(): void

public function retryUntil(): ?CarbonInterface
{
return $this->exporter->getJobRetryUntil();
if (method_exists($this->exporter, 'getJobRetryUntil')) {
return $this->exporter->getJobRetryUntil();
}

return null;
}

/**
Expand Down
6 changes: 0 additions & 6 deletions packages/actions/src/Imports/Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Filament\Actions\Imports;

use Carbon\CarbonInterface;
use Filament\Actions\Imports\Models\Import;
use Filament\Forms\Components\Component;
use Illuminate\Database\Eloquent\Model;
Expand Down Expand Up @@ -291,11 +290,6 @@ public function getJobMiddleware(): array
];
}

public function getJobRetryUntil(): ?CarbonInterface
{
return now()->addDay();
}

/**
* @return array<int, string>
*/
Expand Down
6 changes: 5 additions & 1 deletion packages/actions/src/Imports/Jobs/ImportCsv.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ public function handle(): void

public function retryUntil(): ?CarbonInterface
{
return $this->importer->getJobRetryUntil();
if (method_exists($this->importer, 'getJobRetryUntil')) {
return $this->importer->getJobRetryUntil();
}

return null;
}

/**
Expand Down