1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-05-06 19:44:03 +00:00

Extend retry policy to all queued jobs and add $backoff

- Add $backoff = [30, 60, 120] to the 4 DB lifecycle jobs (CreateDatabase,
  MigrateDatabase, DeleteDatabase, SeedDatabase). Default backoff is 0
  seconds; without spacing, three retries fire back-to-back as fast as
  the worker can process them.

- Add $tries = 3 and $backoff = [30, 60, 120] to the 4 remaining queued
  jobs in src/Jobs (ClearPendingTenants, CreatePendingTenants,
  CreateStorageSymlinks, RemoveStorageSymlinks) that weren't touched by
  the first commit.

All 8 ShouldQueue classes in src/Jobs/ now share the same count-based
retry policy. DeleteDomains stays untouched (it's sync, not queued).
This commit is contained in:
Josh Salway 2026-04-20 11:12:42 +10:00
parent 02093d67d8
commit 39f01e2b54
8 changed files with 24 additions and 0 deletions

View file

@ -15,6 +15,10 @@ class ClearPendingTenants implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable;
public int $tries = 3;
public array $backoff = [30, 60, 120];
public function handle(): void
{
Artisan::call(ClearPendingTenantsCommand::class);

View file

@ -23,6 +23,8 @@ class CreateDatabase implements ShouldQueue
public int $tries = 3;
public array $backoff = [30, 60, 120];
public static bool $ignoreExisting = false;
public function __construct(

View file

@ -15,6 +15,10 @@ class CreatePendingTenants implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable;
public int $tries = 3;
public array $backoff = [30, 60, 120];
public function handle(): void
{
Artisan::call(CreatePendingTenantsCommand::class);

View file

@ -16,6 +16,10 @@ class CreateStorageSymlinks implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public int $tries = 3;
public array $backoff = [30, 60, 120];
public function __construct(
public Tenant $tenant,
) {}

View file

@ -20,6 +20,8 @@ class DeleteDatabase implements ShouldQueue
public int $tries = 3;
public array $backoff = [30, 60, 120];
public function __construct(
protected TenantWithDatabase&Model $tenant,
) {}

View file

@ -19,6 +19,8 @@ class MigrateDatabase implements ShouldQueue
public int $tries = 3;
public array $backoff = [30, 60, 120];
public function __construct(
protected TenantWithDatabase&Model $tenant,
) {}

View file

@ -16,6 +16,10 @@ class RemoveStorageSymlinks implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public int $tries = 3;
public array $backoff = [30, 60, 120];
public Tenant $tenant;
/**

View file

@ -19,6 +19,8 @@ class SeedDatabase implements ShouldQueue
public int $tries = 3;
public array $backoff = [30, 60, 120];
public function __construct(
protected TenantWithDatabase&Model $tenant,
) {}