Class: Smith::Workflow::Graph::RetryPolicyDiagnostic

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/smith/workflow/graph/retry_policy_diagnostic.rb

Instance Method Summary collapse

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/smith/workflow/graph/retry_policy_diagnostic.rb', line 13

def call
  attempts = transition.retry_config&.fetch(:attempts, nil)
  limit = Smith.config.retry_attempt_limit
  return unless attempts && attempts > limit

  Diagnostic.new(
    severity: :error,
    code: :retry_attempt_limit_exceeded,
    transition: transition.name,
    message: "Transition #{ref(transition.name)} declares #{attempts} retry attempts, " \
             "exceeding the configured limit #{limit}.",
    suggestion: "Reduce the retry attempts or explicitly raise Smith.config.retry_attempt_limit."
  )
end