add debug logs to debug the logs - lol
This commit is contained in:
@@ -1026,11 +1026,21 @@ $schema://$host {
|
|||||||
$unreachableNotificationSent = (bool) $this->unreachable_notification_sent;
|
$unreachableNotificationSent = (bool) $this->unreachable_notification_sent;
|
||||||
$isReachable = (bool) $this->settings->is_reachable;
|
$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) {
|
if ($isReachable === true) {
|
||||||
$this->unreachable_count = 0;
|
$this->unreachable_count = 0;
|
||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
if ($unreachableNotificationSent === true) {
|
if ($unreachableNotificationSent === true) {
|
||||||
|
\Log::debug('Server is now reachable, sending notification', [
|
||||||
|
'server_id' => $this->id,
|
||||||
|
]);
|
||||||
$this->sendReachableNotification();
|
$this->sendReachableNotification();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1038,9 +1048,17 @@ $schema://$host {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->increment('unreachable_count');
|
$this->increment('unreachable_count');
|
||||||
|
\Log::debug('Incremented unreachable count', [
|
||||||
|
'server_id' => $this->id,
|
||||||
|
'new_count' => $this->unreachable_count,
|
||||||
|
]);
|
||||||
|
|
||||||
if ($this->unreachable_count === 1) {
|
if ($this->unreachable_count === 1) {
|
||||||
$this->settings->is_reachable = true;
|
$this->settings->is_reachable = true;
|
||||||
$this->settings->save();
|
$this->settings->save();
|
||||||
|
\Log::debug('First unreachable attempt, marking as reachable', [
|
||||||
|
'server_id' => $this->id,
|
||||||
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1049,6 +1067,11 @@ $schema://$host {
|
|||||||
$failedChecks = 0;
|
$failedChecks = 0;
|
||||||
for ($i = 0; $i < 3; $i++) {
|
for ($i = 0; $i < 3; $i++) {
|
||||||
$status = $this->serverStatus();
|
$status = $this->serverStatus();
|
||||||
|
\Log::debug('Additional reachability check', [
|
||||||
|
'server_id' => $this->id,
|
||||||
|
'attempt' => $i + 1,
|
||||||
|
'status' => $status,
|
||||||
|
]);
|
||||||
sleep(5);
|
sleep(5);
|
||||||
if (! $status) {
|
if (! $status) {
|
||||||
$failedChecks++;
|
$failedChecks++;
|
||||||
@@ -1056,6 +1079,9 @@ $schema://$host {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($failedChecks === 3 && ! $unreachableNotificationSent) {
|
if ($failedChecks === 3 && ! $unreachableNotificationSent) {
|
||||||
|
\Log::debug('Server confirmed unreachable after 3 attempts, sending notification', [
|
||||||
|
'server_id' => $this->id,
|
||||||
|
]);
|
||||||
$this->sendUnreachableNotification();
|
$this->sendUnreachableNotification();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user