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.

fix: containerStatus job

Andras Bacsai2f93f4450fb2
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index 730cf4113c..8bbab00815 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -19,13 +19,9 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule): void
{
if (isDev()) {
- // $schedule->job(new ContainerStatusJob(Server::find(0)))->everyTenMinutes()->onOneServer();
- // $schedule->command('horizon:snapshot')->everyMinute();
+ $schedule->command('horizon:snapshot')->everyMinute();
$schedule->job(new CleanupInstanceStuffsJob)->everyMinute()->onOneServer();
- // $schedule->job(new CheckResaleLicenseJob)->hourly();
- // $schedule->job(new DockerCleanupJob)->everyOddHour();
- // $this->instance_auto_update($schedule);
- // $this->check_scheduled_backups($schedule);
+ $this->check_scheduled_backups($schedule);
$this->check_resources($schedule);
$this->cleanup_servers($schedule);
$this->check_scheduled_backups($schedule);
@@ -69,7 +65,6 @@ class Kernel extends ConsoleKernel
}
private function check_scheduled_backups($schedule)
{
- ray('check_scheduled_backups');
$scheduled_backups = ScheduledDatabaseBackup::all();
if ($scheduled_backups->isEmpty()) {
ray('no scheduled backups');
diff --git a/app/Jobs/ContainerStatusJob.php b/app/Jobs/ContainerStatusJob.php
index 4e9f539907..24c869219d 100644
--- a/app/Jobs/ContainerStatusJob.php
+++ b/app/Jobs/ContainerStatusJob.php
@@ -12,7 +12,6 @@ use App\Notifications\Server\Revived;
use App\Notifications\Server\Unreachable;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
-use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
@@ -25,28 +24,23 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- public $tries = 1;
- public $timeout = 120;
-
- public function middleware(): array
+ public function __construct(public Server $server)
{
- return [(new WithoutOverlapping($this->server->uuid))->dontRelease()];
}
-
- public function uniqueId(): string
+ public function middleware(): array
{
- return $this->server->uuid;
+ return [(new WithoutOverlapping($this->server->id))->dontRelease()];
}
- public function __construct(public Server $server)
+ public function uniqueId(): int
{
- $this->handle();
+ return $this->server->id;
}
- public function handle()
+ public function handle(): void
{
+ ray("checking server status for {$this->server->id}");
try {
- // ray("checking server status for {$this->server->id}");
// ray()->clearAll();
$serverUptimeCheckNumber = $this->server->unreachable_count;
$serverUptimeCheckNumberMax = 3;
@@ -305,7 +299,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
} catch (\Throwable $e) {
send_internal_notification('ContainerStatusJob failed with: ' . $e->getMessage());
ray($e->getMessage());
- return handleError($e);
+ handleError($e);
}
}
}