Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor(jobs): update WithoutOverlapping middleware to use expireAfter for better queue management

Andras Bacsaib78f2cccff29
diff --git a/app/Jobs/CleanupInstanceStuffsJob.php b/app/Jobs/CleanupInstanceStuffsJob.php
index 84f14ed02a..0084923420 100644
--- a/app/Jobs/CleanupInstanceStuffsJob.php
+++ b/app/Jobs/CleanupInstanceStuffsJob.php
@@ -17,11 +17,13 @@ class CleanupInstanceStuffsJob implements ShouldBeEncrypted, ShouldBeUnique, Sho
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
+ public $timeout = 60;
+
public function __construct() {}
public function middleware(): array
{
- return [(new WithoutOverlapping('cleanup-instance-stuffs'))->dontRelease()];
+ return [(new WithoutOverlapping('cleanup-instance-stuffs'))->expireAfter(60)];
}
public function handle(): void
diff --git a/app/Jobs/PushServerUpdateJob.php b/app/Jobs/PushServerUpdateJob.php
index 93b203fcbd..4d40240f93 100644
--- a/app/Jobs/PushServerUpdateJob.php
+++ b/app/Jobs/PushServerUpdateJob.php
@@ -71,7 +71,7 @@ class PushServerUpdateJob implements ShouldBeEncrypted, ShouldQueue
public function middleware(): array
{
- return [(new WithoutOverlapping($this->server->uuid))->dontRelease()];
+ return [(new WithoutOverlapping($this->server->uuid))->expireAfter(30)];
}
public function backoff(): int
diff --git a/app/Jobs/RestartProxyJob.php b/app/Jobs/RestartProxyJob.php
index 7fc716f70c..4e1ade0daa 100644
--- a/app/Jobs/RestartProxyJob.php
+++ b/app/Jobs/RestartProxyJob.php
@@ -24,7 +24,7 @@ class RestartProxyJob implements ShouldBeEncrypted, ShouldQueue
public function middleware(): array
{
- return [(new WithoutOverlapping($this->server->uuid))->dontRelease()];
+ return [(new WithoutOverlapping($this->server->uuid))->expireAfter(60)];
}
public function __construct(public Server $server) {}
diff --git a/app/Jobs/ServerCheckJob.php b/app/Jobs/ServerCheckJob.php
index 9818d5c6a0..ffa298390d 100644
--- a/app/Jobs/ServerCheckJob.php
+++ b/app/Jobs/ServerCheckJob.php
@@ -28,7 +28,7 @@ class ServerCheckJob implements ShouldBeEncrypted, ShouldQueue
public function middleware(): array
{
- return [(new WithoutOverlapping($this->server->uuid))->dontRelease()];
+ return [(new WithoutOverlapping($this->server->uuid))->expireAfter(60)];
}
public function __construct(public Server $server) {}