Class: Henitai::SlotScheduler::RetryPolicy

Inherits:
Object
  • Object
show all
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

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

Returns:

  • (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