increment('consecutive_poll_failures'); $instance->refresh(); $ntfyUrl = config('services.ntfy.url'); $ntfyThreshold = (int) config('services.ntfy.threshold'); $ntfyTopic = config('services.ntfy.topic'); if ($ntfyUrl === null || $ntfyThreshold === 0 || $ntfyTopic === null) { return; } if ($instance->consecutive_poll_failures < $ntfyThreshold) { return; } try { Http::timeout(5) ->withBody($instance->url . ' - ' . $message, 'text/plain') ->post(rtrim($ntfyUrl, '/') . '/' . $ntfyTopic); } catch (Exception $e) { logger()->warning('ntfy alert failed', ['instance' => $instance->url, 'error' => $e->getMessage()]); } } }