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.

refactor(Server): remove debug logging from isReachableChanged method to clean up code and improve performance

Andras Bacsai8b3c4d7ad922
diff --git a/app/Models/Server.php b/app/Models/Server.php
index 60d0da3eda..41af45f30f 100644
--- a/app/Models/Server.php
+++ b/app/Models/Server.php
@@ -20,7 +20,6 @@ use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Stringable;
use OpenApi\Attributes as OA;
@@ -1026,22 +1025,11 @@ $schema://$host {
$this->refresh();
$unreachableNotificationSent = (bool) $this->unreachable_notification_sent;
$isReachable = (bool) $this->settings->is_reachable;
-
- Log::debug('Server reachability check', [
- 'server_id' => $this->id,
- 'is_reachable' => $isReachable,
- 'notification_sent' => $unreachableNotificationSent,
- 'unreachable_count' => $this->unreachable_count,
- ]);
-
if ($isReachable === true) {
$this->unreachable_count = 0;
$this->save();
if ($unreachableNotificationSent === true) {
- Log::debug('Server is now reachable, sending notification', [
- 'server_id' => $this->id,
- ]);
$this->sendReachableNotification();
}
@@ -1049,17 +1037,10 @@ $schema://$host {
}
$this->increment('unreachable_count');
- Log::debug('Incremented unreachable count', [
- 'server_id' => $this->id,
- 'new_count' => $this->unreachable_count,
- ]);
if ($this->unreachable_count === 1) {
$this->settings->is_reachable = true;
$this->settings->save();
- Log::debug('First unreachable attempt, marking as reachable', [
- 'server_id' => $this->id,
- ]);
return;
}
@@ -1068,11 +1049,6 @@ $schema://$host {
$failedChecks = 0;
for ($i = 0; $i < 3; $i++) {
$status = $this->serverStatus();
- Log::debug('Additional reachability check', [
- 'server_id' => $this->id,
- 'attempt' => $i + 1,
- 'status' => $status,
- ]);
sleep(5);
if (! $status) {
$failedChecks++;
@@ -1080,9 +1056,6 @@ $schema://$host {
}
if ($failedChecks === 3 && ! $unreachableNotificationSent) {
- Log::debug('Server confirmed unreachable after 3 attempts, sending notification', [
- 'server_id' => $this->id,
- ]);
$this->sendUnreachableNotification();
}
}