Class: SourceMonitor::Health::SourceHealthCheckOrchestrator
- Inherits:
-
Object
- Object
- SourceMonitor::Health::SourceHealthCheckOrchestrator
- Defined in:
- lib/source_monitor/health/source_health_check_orchestrator.rb
Overview
Orchestrates a source health check: runs the probe, broadcasts UI updates with toast notifications, triggers a follow-up fetch for degraded sources, and handles unexpected errors gracefully. Extracted from SourceHealthCheckJob.
Constant Summary collapse
- DEGRADED_STATUSES =
%w[declining failing].freeze
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(source) ⇒ SourceHealthCheckOrchestrator
constructor
A new instance of SourceHealthCheckOrchestrator.
Constructor Details
#initialize(source) ⇒ SourceHealthCheckOrchestrator
Returns a new instance of SourceHealthCheckOrchestrator.
12 13 14 |
# File 'lib/source_monitor/health/source_health_check_orchestrator.rb', line 12 def initialize(source) @source = source end |
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/source_monitor/health/source_health_check_orchestrator.rb', line 16 def call result = SourceMonitor::Health::SourceHealthCheck.new(source: source).call broadcast_outcome(result) trigger_fetch_if_degraded(result) rescue StandardError => error log_error(error) record_unexpected_failure(error) broadcast_outcome(nil, error) end |