mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 23:04:04 +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:
parent
02093d67d8
commit
39f01e2b54
8 changed files with 24 additions and 0 deletions
|
|
@ -15,6 +15,10 @@ class ClearPendingTenants implements ShouldQueue
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable;
|
use Dispatchable, InteractsWithQueue, Queueable;
|
||||||
|
|
||||||
|
public int $tries = 3;
|
||||||
|
|
||||||
|
public array $backoff = [30, 60, 120];
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
Artisan::call(ClearPendingTenantsCommand::class);
|
Artisan::call(ClearPendingTenantsCommand::class);
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ class CreateDatabase implements ShouldQueue
|
||||||
|
|
||||||
public int $tries = 3;
|
public int $tries = 3;
|
||||||
|
|
||||||
|
public array $backoff = [30, 60, 120];
|
||||||
|
|
||||||
public static bool $ignoreExisting = false;
|
public static bool $ignoreExisting = false;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ class CreatePendingTenants implements ShouldQueue
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable;
|
use Dispatchable, InteractsWithQueue, Queueable;
|
||||||
|
|
||||||
|
public int $tries = 3;
|
||||||
|
|
||||||
|
public array $backoff = [30, 60, 120];
|
||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
Artisan::call(CreatePendingTenantsCommand::class);
|
Artisan::call(CreatePendingTenantsCommand::class);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@ class CreateStorageSymlinks implements ShouldQueue
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public int $tries = 3;
|
||||||
|
|
||||||
|
public array $backoff = [30, 60, 120];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public Tenant $tenant,
|
public Tenant $tenant,
|
||||||
) {}
|
) {}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ class DeleteDatabase implements ShouldQueue
|
||||||
|
|
||||||
public int $tries = 3;
|
public int $tries = 3;
|
||||||
|
|
||||||
|
public array $backoff = [30, 60, 120];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected TenantWithDatabase&Model $tenant,
|
protected TenantWithDatabase&Model $tenant,
|
||||||
) {}
|
) {}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ class MigrateDatabase implements ShouldQueue
|
||||||
|
|
||||||
public int $tries = 3;
|
public int $tries = 3;
|
||||||
|
|
||||||
|
public array $backoff = [30, 60, 120];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected TenantWithDatabase&Model $tenant,
|
protected TenantWithDatabase&Model $tenant,
|
||||||
) {}
|
) {}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@ class RemoveStorageSymlinks implements ShouldQueue
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public int $tries = 3;
|
||||||
|
|
||||||
|
public array $backoff = [30, 60, 120];
|
||||||
|
|
||||||
public Tenant $tenant;
|
public Tenant $tenant;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ class SeedDatabase implements ShouldQueue
|
||||||
|
|
||||||
public int $tries = 3;
|
public int $tries = 3;
|
||||||
|
|
||||||
|
public array $backoff = [30, 60, 120];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected TenantWithDatabase&Model $tenant,
|
protected TenantWithDatabase&Model $tenant,
|
||||||
) {}
|
) {}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue