Skip to main content

Module health

Module health 

Source
Expand description

Health-based watchdog integration

Provides a health checker that only pings the systemd watchdog when the service is healthy. If health checks fail, the watchdog won’t be pinged and systemd will eventually restart the service.

§Architecture

┌─────────────────────────────────────────────┐
│              HealthChecker                  │
│  ┌─────────────────────────────────────┐   │
│  │  check_zmq_connectivity()           │   │
│  │  check_http_endpoint()              │   │
│  │  check_memory_pressure()            │   │
│  └─────────────────────────────────────┘   │
│                    │                        │
│                    ▼                        │
│  ┌─────────────────────────────────────┐   │
│  │  is_healthy() -> bool               │   │
│  │  (all checks must pass)             │   │
│  └─────────────────────────────────────┘   │
└─────────────────────────────────────────────┘
                     │
                     ▼
┌─────────────────────────────────────────────┐
│           run_watchdog()                    │
│  if is_healthy() { SystemdNotifier::watchdog() }
└─────────────────────────────────────────────┘

§Usage

ⓘ
use hyprstream_core::systemd::health::{HealthChecker, run_watchdog};

let checker = HealthChecker::new();

// Spawn watchdog task (runs until shutdown)
tokio::spawn(run_watchdog(checker));

Structs§

HealthChecker
Health checker for watchdog integration
HealthConfig
Health check configuration

Functions§

run_watchdog
Run the watchdog task
run_watchdog_with_shutdown
Run watchdog with a shutdown signal