add debug logs to debug the logs - lol
This commit is contained in:
parent
203a20e75e
commit
a8401182af
1 changed files with 26 additions and 0 deletions
|
|
@ -1026,11 +1026,21 @@ public function isReachableChanged()
|
|||
$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();
|
||||
}
|
||||
|
||||
|
|
@ -1038,9 +1048,17 @@ public function isReachableChanged()
|
|||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
|
@ -1049,6 +1067,11 @@ public function isReachableChanged()
|
|||
$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++;
|
||||
|
|
@ -1056,6 +1079,9 @@ public function isReachableChanged()
|
|||
}
|
||||
|
||||
if ($failedChecks === 3 && ! $unreachableNotificationSent) {
|
||||
\Log::debug('Server confirmed unreachable after 3 attempts, sending notification', [
|
||||
'server_id' => $this->id,
|
||||
]);
|
||||
$this->sendUnreachableNotification();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue