chore: remove ray debugging

This commit is contained in:
peaklabs-dev
2024-12-16 14:15:38 +01:00
parent 80425a16ee
commit 0957fe8bfc

View File

@@ -1026,29 +1026,18 @@ $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;
ray('Server Reachability Check', [
'server_id' => $this->id,
'unreachable_notification_sent' => $unreachableNotificationSent,
'is_reachable' => $isReachable,
'unreachable_count' => $this->unreachable_count,
]);
if ($isReachable === true) { if ($isReachable === true) {
ray('Server is reachable - resetting counts');
$this->unreachable_count = 0; $this->unreachable_count = 0;
$this->save(); $this->save();
if ($unreachableNotificationSent === true) { if ($unreachableNotificationSent === true) {
ray('Sending reachable notification');
$this->sendReachableNotification(); $this->sendReachableNotification();
} }
return; return;
} }
ray('Server is not reachable - incrementing count');
$this->increment('unreachable_count'); $this->increment('unreachable_count');
ray('Unreachable 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();
@@ -1057,27 +1046,16 @@ $schema://$host {
} }
if ($this->unreachable_count >= 2 && ! $unreachableNotificationSent) { if ($this->unreachable_count >= 2 && ! $unreachableNotificationSent) {
ray('Starting additional checks', [
'unreachable_count' => $this->unreachable_count,
]);
$failedChecks = 0; $failedChecks = 0;
for ($i = 0; $i < 3; $i++) { for ($i = 0; $i < 3; $i++) {
$status = $this->status(); $status = $this->status();
sleep(5); sleep(5);
ray('Check attempt '.($i + 1), ['status' => $status]);
if (! $status) { if (! $status) {
$failedChecks++; $failedChecks++;
} }
} }
ray('Additional checks complete', [
'failed_checks' => $failedChecks,
'will_send_notification' => ($failedChecks === 3 && ! $unreachableNotificationSent),
]);
if ($failedChecks === 3 && ! $unreachableNotificationSent) { if ($failedChecks === 3 && ! $unreachableNotificationSent) {
ray('Sending unreachable notification');
$this->sendUnreachableNotification(); $this->sendUnreachableNotification();
} }
} }