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;
|
||||
$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 @@ $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;
|
||||
}
|
||||
@@ -1049,6 +1067,11 @@ $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++;
|
||||
@@ -1056,6 +1079,9 @@ $schema://$host {
|
||||
}
|
||||
|
||||
if ($failedChecks === 3 && ! $unreachableNotificationSent) {
|
||||
\Log::debug('Server confirmed unreachable after 3 attempts, sending notification', [
|
||||
'server_id' => $this->id,
|
||||
]);
|
||||
$this->sendUnreachableNotification();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user