mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-06 13:10:37 -04:00
fix(sentinel): stop hourly check job pile-up and self-heal Sentinel
- Start Sentinel with --restart unless-stopped so Docker restarts it after a crash or reboot. - Make CheckAndStartSentinelJob unique per server so copies cannot collect in a slow queue. - Read X-Sentinel-Version on push and update an outdated Sentinel without SSH; skip the hourly SSH version check for servers that report their version.
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Models\Server;
|
||||
use App\Models\Team;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Queue;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -56,6 +57,15 @@ it('dispatches an hourly Sentinel version check for a healthy Sentinel', functio
|
||||
});
|
||||
});
|
||||
|
||||
it('skips the hourly SSH version check when Sentinel reports its version on push', function () {
|
||||
$server = createSentinelCheckServer($this->team, Carbon::now());
|
||||
Cache::put(Server::sentinelReportedVersionCacheKey($server->id), '1.0.2', now()->addHours(2));
|
||||
|
||||
(new ServerManagerJob)->handle();
|
||||
|
||||
Queue::assertNotPushed(CheckAndStartSentinelJob::class);
|
||||
});
|
||||
|
||||
it('does not schedule periodic Sentinel restart checks', function () {
|
||||
$root = dirname(__DIR__, 2);
|
||||
$manager = file_get_contents($root.'/app/Jobs/ServerManagerJob.php');
|
||||
|
||||
Reference in New Issue
Block a user