Class: Henitai::SlotScheduler::RetryPolicy
- Inherits:
-
Object
- Object
- Henitai::SlotScheduler::RetryPolicy
- Defined in:
- lib/henitai/slot_scheduler/retry_policy.rb
Overview
Decides whether a finished slot earns another attempt.
A survived verdict is the only retryable one: it is the verdict a flaky test can fake, whereas a kill cannot be faked by flakiness. A requested shutdown vetoes retries outright — respawning children while tearing the run down would leak processes past the drain window.
Instance Method Summary collapse
-
#initialize(max_retries:) ⇒ RetryPolicy
constructor
A new instance of RetryPolicy.
- #retry?(slot:, result:, shutdown:) ⇒ Boolean
Constructor Details
#initialize(max_retries:) ⇒ RetryPolicy
Returns a new instance of RetryPolicy.
12 13 14 |
# File 'lib/henitai/slot_scheduler/retry_policy.rb', line 12 def initialize(max_retries:) @max_retries = max_retries.to_i end |
Instance Method Details
#retry?(slot:, result:, shutdown:) ⇒ Boolean
16 17 18 |
# File 'lib/henitai/slot_scheduler/retry_policy.rb', line 16 def retry?(slot:, result:, shutdown:) !shutdown && result.survived? && slot.retry_count < @max_retries end |