From 39f01e2b5408e1e8aefa80f0df86a374b9beb055 Mon Sep 17 00:00:00 2001 From: Josh Salway Date: Mon, 20 Apr 2026 11:12:42 +1000 Subject: [PATCH] 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). --- src/Jobs/ClearPendingTenants.php | 4 ++++ src/Jobs/CreateDatabase.php | 2 ++ src/Jobs/CreatePendingTenants.php | 4 ++++ src/Jobs/CreateStorageSymlinks.php | 4 ++++ src/Jobs/DeleteDatabase.php | 2 ++ src/Jobs/MigrateDatabase.php | 2 ++ src/Jobs/RemoveStorageSymlinks.php | 4 ++++ src/Jobs/SeedDatabase.php | 2 ++ 8 files changed, 24 insertions(+) diff --git a/src/Jobs/ClearPendingTenants.php b/src/Jobs/ClearPendingTenants.php index d353bd5e..d34d228d 100644 --- a/src/Jobs/ClearPendingTenants.php +++ b/src/Jobs/ClearPendingTenants.php @@ -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); diff --git a/src/Jobs/CreateDatabase.php b/src/Jobs/CreateDatabase.php index 2d4e2240..13021d37 100644 --- a/src/Jobs/CreateDatabase.php +++ b/src/Jobs/CreateDatabase.php @@ -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( diff --git a/src/Jobs/CreatePendingTenants.php b/src/Jobs/CreatePendingTenants.php index 0163ac3a..637fe5b8 100644 --- a/src/Jobs/CreatePendingTenants.php +++ b/src/Jobs/CreatePendingTenants.php @@ -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); diff --git a/src/Jobs/CreateStorageSymlinks.php b/src/Jobs/CreateStorageSymlinks.php index 4493de09..f7d77ff4 100644 --- a/src/Jobs/CreateStorageSymlinks.php +++ b/src/Jobs/CreateStorageSymlinks.php @@ -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, ) {} diff --git a/src/Jobs/DeleteDatabase.php b/src/Jobs/DeleteDatabase.php index e364d7cb..b5397f99 100644 --- a/src/Jobs/DeleteDatabase.php +++ b/src/Jobs/DeleteDatabase.php @@ -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, ) {} diff --git a/src/Jobs/MigrateDatabase.php b/src/Jobs/MigrateDatabase.php index 358c4678..df45e59b 100644 --- a/src/Jobs/MigrateDatabase.php +++ b/src/Jobs/MigrateDatabase.php @@ -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, ) {} diff --git a/src/Jobs/RemoveStorageSymlinks.php b/src/Jobs/RemoveStorageSymlinks.php index 8579175f..fda86e59 100644 --- a/src/Jobs/RemoveStorageSymlinks.php +++ b/src/Jobs/RemoveStorageSymlinks.php @@ -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; /** diff --git a/src/Jobs/SeedDatabase.php b/src/Jobs/SeedDatabase.php index f0c49568..90d926cd 100644 --- a/src/Jobs/SeedDatabase.php +++ b/src/Jobs/SeedDatabase.php @@ -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, ) {}