Function relayer_health_check_handler

Source
pub async fn relayer_health_check_handler(
    job: Job<RelayerHealthCheck>,
    app_state: Data<ThinData<DefaultAppState>>,
    attempt: Attempt,
) -> Result<(), Error>
Expand description

Handler for relayer health check jobs.

This event-driven handler:

  1. Checks if the relayer is disabled (exits early if not)
  2. Runs stateless health checks on the disabled relayer
  3. On success: Re-enables the relayer and sends a recovery notification
  4. On failure: Updates the disabled reason (if changed) and schedules retry with exponential backoff

§Behavior

  • Early exit: If relayer is not disabled, exits without running checks
  • Recovery notification: Unlike bootstrap (silent), sends notification when re-enabled
  • Reason tracking: Updates disabled_reason if the failure reason changes between retries
  • No redundant updates: Only updates reason when it actually changes

§Arguments

  • job - The job containing relayer health check data
  • app_state - Application state with repositories and services
  • attempt - Current attempt number for retry logic

§Returns

Returns Ok(()) if the health check completes successfully, or an error otherwise.