mirror of
https://github.com/archtechx/tenancy.git
synced 2026-05-06 20:54:02 +00:00
Add $tries = 3 to tenant lifecycle jobs
Adds a bounded retry count to CreateDatabase, MigrateDatabase, DeleteDatabase, and SeedDatabase. Without $tries, and with queue:work --tries=0 (the default on some platforms including Vapor pre-2.4.1), these jobs retry indefinitely when the tenant database is briefly unreachable. DeleteDatabase is the highest-risk case in the four: if the DB server blips mid-delete, the job loops against it, and any replays after recovery hit a database that may have been partly deleted or may contain data the tenant wanted preserved. `$tries = 3` bounds retries at three attempts; workers then surface the failure to failed_jobs for operator review rather than looping.
This commit is contained in:
parent
c32f52ce7c
commit
02093d67d8
4 changed files with 8 additions and 0 deletions
|
|
@ -21,6 +21,8 @@ class CreateDatabase implements ShouldQueue
|
|||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public int $tries = 3;
|
||||
|
||||
public static bool $ignoreExisting = false;
|
||||
|
||||
public function __construct(
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ class DeleteDatabase implements ShouldQueue
|
|||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public int $tries = 3;
|
||||
|
||||
public function __construct(
|
||||
protected TenantWithDatabase&Model $tenant,
|
||||
) {}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ class MigrateDatabase implements ShouldQueue
|
|||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public int $tries = 3;
|
||||
|
||||
public function __construct(
|
||||
protected TenantWithDatabase&Model $tenant,
|
||||
) {}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ class SeedDatabase implements ShouldQueue
|
|||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public int $tries = 3;
|
||||
|
||||
public function __construct(
|
||||
protected TenantWithDatabase&Model $tenant,
|
||||
) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue