Tighten retry shape: $tries=1, $uniqueFor=600, drop $timeout and $backoff

Most failures for these jobs are GitHub API rate-limit responses;
retries inside the same window do not help, so one attempt is enough
and $backoff has nothing to pace.

$timeout would clip the intentionally throttled handle() loop
(sleep(1) per app) below realistic workloads. Heavy users with 60+
apps would lose updates mid-cycle. The original code left $timeout
unset, and `UpdateApps` is dispatched via `dispatchAfterResponse()`
which doesn't go through `queue:work` at all (the queue $timeout
is irrelevant in that path). Letting the operator's worker config
govern is more honest.

$uniqueFor reduced to 600 (10 min) since with $tries=1 +
worker-governed timeout there is no long retry chain to outlive.
Lock self-heals 10 minutes after a crashed worker.
This commit is contained in:
Josh Salway
2026-04-22 16:57:49 +10:00
parent 44be3cb319
commit 5be7a65677
2 changed files with 14 additions and 26 deletions
+6 -11
View File
@@ -21,21 +21,16 @@ class ProcessApps implements ShouldQueue, ShouldBeUnique
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Bound total attempts so a failed job stops after three retries across
* worker restarts, independent of the broker's reserved-job recovery path.
* Most failures here are GitHub rate-limit responses; retries inside the
* same window do not help, so a single attempt is enough.
*/
public int $tries = 3;
/** @var array<int, int> seconds between retries */
public array $backoff = [30, 60, 120];
public int $timeout = 60;
public int $tries = 1;
/**
* Expire the ShouldBeUnique lock after 1 hour so a crashed worker does
* not permanently block future ProcessApps dispatches.
* Expire the ShouldBeUnique lock after 10 minutes so a crashed worker
* does not permanently block future ProcessApps dispatches.
*/
public int $uniqueFor = 3600;
public int $uniqueFor = 600;
/**
* Create a new job instance.
+8 -15
View File
@@ -19,25 +19,18 @@ class UpdateApps implements ShouldQueue, ShouldBeUnique
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* Bound total attempts so a failed job stops after three retries across
* worker restarts, independent of the broker's reserved-job recovery path.
* Most failures here are GitHub rate-limit responses; retries inside the
* same window do not help, so a single attempt is enough. The throttle
* loop in handle() means the job is intentionally long-running, so we
* leave $timeout unset and let the operator's worker config govern.
*/
public int $tries = 3;
/** @var array<int, int> seconds between retries */
public array $backoff = [30, 60, 120];
public int $tries = 1;
/**
* Per-attempt wall-clock ceiling. Heavy users with many apps may need
* a larger value; 60s covers the typical Heimdall deployment.
* Expire the ShouldBeUnique lock after 10 minutes so a crashed worker
* does not permanently block future UpdateApps dispatches.
*/
public int $timeout = 60;
/**
* Expire the ShouldBeUnique lock after 1 hour so a crashed worker does
* not permanently block future UpdateApps dispatches.
*/
public int $uniqueFor = 3600;
public int $uniqueFor = 600;
/**
* Create a new job instance.