fix(storage): let the S3 revalidation unique lock expire

RevalidateUnusableS3StoragesJob had no uniqueFor. A lock left by a
stopped worker blocked the job for up to 24 hours, so unusable S3
storages were not checked again and their backups were skipped.

- Set uniqueFor to 1800 seconds
This commit is contained in:
Andras Bacsai
2026-10-05 21:19:19 +02:00
parent df51b23bc2
commit 0facde67a8
2 changed files with 30 additions and 0 deletions
@@ -0,0 +1,25 @@
<?php
use App\Jobs\RevalidateUnusableS3StoragesJob;
use Illuminate\Support\Facades\Queue;
beforeEach(function () {
config()->set('cache.default', 'array');
Queue::fake();
});
it('does not queue a second revalidation while the unique lock is held', function () {
RevalidateUnusableS3StoragesJob::dispatch();
$this->travel(29)->minutes();
RevalidateUnusableS3StoragesJob::dispatch();
Queue::assertPushed(RevalidateUnusableS3StoragesJob::class, 1);
});
it('queues the revalidation again after a lock left by a killed worker expires', function () {
RevalidateUnusableS3StoragesJob::dispatch();
$this->travel(31)->minutes();
RevalidateUnusableS3StoragesJob::dispatch();
Queue::assertPushed(RevalidateUnusableS3StoragesJob::class, 2);
});