From 781bf52a8ea9fc56307840c7ee2324e1d71d6794 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Wed, 8 May 2024 19:32:13 +0200 Subject: [PATCH] Refactor PullSentinelImageJob.php to only start Sentinel if local version is outdated --- app/Jobs/PullSentinelImageJob.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/Jobs/PullSentinelImageJob.php b/app/Jobs/PullSentinelImageJob.php index 8e41adecf..4293ae030 100644 --- a/app/Jobs/PullSentinelImageJob.php +++ b/app/Jobs/PullSentinelImageJob.php @@ -39,12 +39,11 @@ public function handle(): void return; } $local_version = instant_remote_process(['docker exec coolify-sentinel sh -c "curl http://127.0.0.1:8888/api/version"'], $this->server, '0.0.0'); - if ($version === $local_version) { - ray('Sentinel image is up to date'); + if (version_compare($local_version, $version, '<')) { + StartSentinel::run($this->server, $version, true); return; } - ray('Pulling Sentinel image'); - StartSentinel::run($this->server, $version, true); + ray('Sentinel image is up to date'); } catch (\Throwable $e) { send_internal_notification('PullSentinelImageJob failed with: ' . $e->getMessage()); ray($e->getMessage());