From 22fbbd74ffc18f152302ebf3649a0d74385b9d9f Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Mon, 14 Sep 2026 15:43:52 +0200 Subject: [PATCH] fix(sentinel): restore hourly version checks for enabled servers Dispatch Sentinel checks hourly for eligible servers, including healthy installations, while continuing to exclude build servers. --- app/Jobs/ServerManagerJob.php | 6 ++++++ .../Server/SentinelUpdateCheckIndependenceTest.php | 12 ++++++------ tests/Unit/ServerManagerJobSentinelCheckTest.php | 7 ++++--- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/app/Jobs/ServerManagerJob.php b/app/Jobs/ServerManagerJob.php index 171d4e6949..20b60b9fd2 100644 --- a/app/Jobs/ServerManagerJob.php +++ b/app/Jobs/ServerManagerJob.php @@ -166,6 +166,12 @@ class ServerManagerJob implements ShouldBeEncrypted, ShouldQueue } } + if ($server->isSentinelEnabled() + && shouldRunCronNow('0 * * * *', $serverTimezone, "sentinel-version-check:{$server->id}", $this->executionTime) + ) { + CheckAndStartSentinelJob::dispatch($server); + } + // Dispatch ServerStorageCheckJob if due (only when Sentinel is out of sync or disabled) // When Sentinel is active, PushServerUpdateJob handles storage checks with real-time data if ($sentinelOutOfSync) { diff --git a/tests/Feature/Server/SentinelUpdateCheckIndependenceTest.php b/tests/Feature/Server/SentinelUpdateCheckIndependenceTest.php index 080a3ee7c8..d3ccb5c478 100644 --- a/tests/Feature/Server/SentinelUpdateCheckIndependenceTest.php +++ b/tests/Feature/Server/SentinelUpdateCheckIndependenceTest.php @@ -13,6 +13,7 @@ uses(RefreshDatabase::class); beforeEach(function () { Queue::fake(); + InstanceSettings::forceCreate(['id' => 0]); // Create user (which automatically creates a team) $user = User::factory()->create(); @@ -123,10 +124,9 @@ it('respects server timezone when checking sentinel updates', function () { }); }); -it('does not dispatch sentinel check for servers without sentinel enabled', function () { - // Disable sentinel +it('does not dispatch sentinel check for build servers', function () { $this->server->settings->update([ - 'is_sentinel_enabled' => false, + 'is_build_server' => true, ]); $instanceSettings = InstanceSettings::first(); @@ -144,13 +144,13 @@ it('does not dispatch sentinel check for servers without sentinel enabled', func Queue::assertNotPushed(CheckAndStartSentinelJob::class); }); -it('handles multiple servers with different sentinel configurations', function () { - // Create a second server with sentinel disabled +it('handles multiple servers with different sentinel eligibility', function () { + // Create a second server that cannot run Sentinel $server2 = Server::factory()->create([ 'team_id' => $this->team->id, ]); $server2->settings->update([ - 'is_sentinel_enabled' => false, + 'is_build_server' => true, 'server_timezone' => 'UTC', ]); diff --git a/tests/Unit/ServerManagerJobSentinelCheckTest.php b/tests/Unit/ServerManagerJobSentinelCheckTest.php index 4666565fe4..f2a49bad3d 100644 --- a/tests/Unit/ServerManagerJobSentinelCheckTest.php +++ b/tests/Unit/ServerManagerJobSentinelCheckTest.php @@ -18,7 +18,7 @@ afterEach(function () { Carbon::setTestNow(); }); -it('does not dispatch CheckAndStartSentinelJob hourly anymore', function () { +it('dispatches an hourly Sentinel version check for a healthy Sentinel', function () { $settings = Mockery::mock(InstanceSettings::class); $settings->instance_timezone = 'UTC'; $this->app->instance(InstanceSettings::class, $settings); @@ -39,8 +39,9 @@ it('does not dispatch CheckAndStartSentinelJob hourly anymore', function () { $job = new ServerManagerJob; $job->handle(); - // Hourly CheckAndStartSentinelJob dispatch was removed — ServerCheckJob handles it when Sentinel is out of sync - Queue::assertNotPushed(CheckAndStartSentinelJob::class); + Queue::assertPushed(CheckAndStartSentinelJob::class, function ($job) use ($server) { + return $job->server->id === $server->id; + }); }); it('does not schedule periodic Sentinel restart checks', function () {