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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix(server): reset unreachable_count after successful connection check (#11417)
Kevin Dench07d6c3aeeb4a
diff --git a/app/Jobs/ServerConnectionCheckJob.php b/app/Jobs/ServerConnectionCheckJob.phpindex fe7a20972c..97d211d247 100644--- a/app/Jobs/ServerConnectionCheckJob.php+++ b/app/Jobs/ServerConnectionCheckJob.php@@ -100,7 +100,10 @@ class ServerConnectionCheckJob implements ShouldBeEncrypted, ShouldQueue]);if ($this->server->unreachable_count > 0) {- $this->server->update(['unreachable_count' => 0]);+ // Direct assignment: unreachable_count is not mass-assignable,+ // so update() would silently drop the reset.+ $this->server->unreachable_count = 0;+ $this->server->save();}$this->dispatchReachabilityChangedIfNeeded($wasReachable, $wasNotified, true);diff --git a/tests/Feature/ServerConnectionCheckIsolationTest.php b/tests/Feature/ServerConnectionCheckIsolationTest.phpindex d098c39b55..895304c7d1 100644--- a/tests/Feature/ServerConnectionCheckIsolationTest.php+++ b/tests/Feature/ServerConnectionCheckIsolationTest.php@@ -78,3 +78,21 @@ it('does not call cloud provider APIs during an SSH connection check', functionHttp::assertNothingSent();});++it('resets unreachable_count after a successful connection check', function () {+ $server = createServerForConnectionIsolationTest(['ip' => '203.0.113.10']);+ // unreachable_count is not mass-assignable, so it must be set directly.+ $server->unreachable_count = 5;+ $server->save();++ Process::fake([+ '*' => Process::result(+ output: '{"Server":{"Version":"27.0.0"}}',+ exitCode: 0,+ ),+ ]);++ (new ServerConnectionCheckJob($server->fresh(), disableMux: false))->handle();++ expect($server->fresh()->unreachable_count)->toBe(0);+});