Class: SourceMonitor::Fetching::RetryOrchestrator
- Inherits:
-
Object
- Object
- SourceMonitor::Fetching::RetryOrchestrator
- Defined in:
- lib/source_monitor/fetching/retry_orchestrator.rb
Overview
Executes retry/circuit-breaker decisions produced by RetryPolicy.
Accepts a source, the original fetch error, and a RetryPolicy::Decision, then either enqueues a retry job, opens the circuit, or resets retry state.
Returns a Result struct indicating which path was taken.
Defined Under Namespace
Classes: Result
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(source:, error:, decision:, job_class:, now:) ⇒ RetryOrchestrator
constructor
A new instance of RetryOrchestrator.
Constructor Details
#initialize(source:, error:, decision:, job_class:, now:) ⇒ RetryOrchestrator
Returns a new instance of RetryOrchestrator.
30 31 32 33 34 35 36 |
# File 'lib/source_monitor/fetching/retry_orchestrator.rb', line 30 def initialize(source:, error:, decision:, job_class:, now:) @source = source @error = error @decision = decision @job_class = job_class @now = now end |
Class Method Details
.call(source:, error:, decision:, job_class: SourceMonitor::FetchFeedJob, now: Time.current) ⇒ Object
26 27 28 |
# File 'lib/source_monitor/fetching/retry_orchestrator.rb', line 26 def self.call(source:, error:, decision:, job_class: SourceMonitor::FetchFeedJob, now: Time.current) new(source:, error:, decision:, job_class:, now:).call end |
Instance Method Details
#call ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/source_monitor/fetching/retry_orchestrator.rb', line 38 def call if decision.retry? enqueue_retry! elsif decision.open_circuit? open_circuit! else reset_retry_state! end end |