mirror of
https://github.com/linuxserver/Heimdall.git
synced 2026-08-07 07:16:13 +00:00
243ad00810
Both jobs implement ShouldBeUnique without a $uniqueFor value, which on
Redis and database drivers produces a lock that never expires. If the
worker is killed mid-fire (OOM, SIGKILL, server crash), the lock
persists and blocks all future dispatches of UpdateApps or ProcessApps
until the cache entry is manually cleared.
Neither job sets $tries, $backoff, or $timeout, so they inherit the
worker command's defaults (1 for queue:work, 0 for vapor:work), which
varies by platform and is brittle.
This change adds:
- $uniqueFor = 3600 lock expires after 1 hour
- $tries = 3 hard cap across worker restarts
- $backoff = [30, 60, 120] pace retries to reduce GitHub API load
- $timeout = 60 bound per-attempt wall-clock time
- failed(Throwable) log permanent failures (and preserve the
existing Cache::lock('updateApps')->forceRelease
on UpdateApps)
A new test (tests/Feature/QueueSafetyTest.php) asserts the retry
properties are present.
All existing tests still pass.
40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Jobs\ProcessApps;
|
|
use App\Jobs\UpdateApps;
|
|
use Tests\TestCase;
|
|
|
|
class QueueSafetyTest extends TestCase
|
|
{
|
|
/** @test */
|
|
public function updateApps_has_bounded_retry_properties(): void
|
|
{
|
|
$job = new UpdateApps();
|
|
|
|
$this->assertSame(3, $job->tries);
|
|
$this->assertSame([30, 60, 120], $job->backoff);
|
|
$this->assertSame(60, $job->timeout);
|
|
$this->assertSame(3600, $job->uniqueFor);
|
|
}
|
|
|
|
/** @test */
|
|
public function processApps_has_bounded_retry_properties(): void
|
|
{
|
|
$job = new ProcessApps();
|
|
|
|
$this->assertSame(3, $job->tries);
|
|
$this->assertSame([30, 60, 120], $job->backoff);
|
|
$this->assertSame(60, $job->timeout);
|
|
$this->assertSame(3600, $job->uniqueFor);
|
|
}
|
|
|
|
/** @test */
|
|
public function both_jobs_expose_a_failed_method(): void
|
|
{
|
|
$this->assertTrue(method_exists(UpdateApps::class, 'failed'));
|
|
$this->assertTrue(method_exists(ProcessApps::class, 'failed'));
|
|
}
|
|
}
|