Method: Dynflow::Action::Rescue#rescue_strategy

Defined in:
lib/dynflow/action/rescue.rb

#rescue_strategyObject

What strategy should be used for rescuing from error in the action or its sub actions

When determining the strategy, the algorithm starts from the entry action that by default takes the strategy from #rescue_strategy_for_self and #rescue_strategy_for_planned_actions and combines them together.

Returns:

  • Strategy



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dynflow/action/rescue.rb', line 22

def rescue_strategy
  suggested_strategies = []

  if self.steps.compact.any? { |step| step.state == :error }
    suggested_strategies << SuggestedStrategy[self, rescue_strategy_for_self]
  end

  self.planned_actions.each do |planned_action|
    rescue_strategy = rescue_strategy_for_planned_action(planned_action)
    next unless rescue_strategy # ignore actions that have no say in the rescue strategy
    suggested_strategies << SuggestedStrategy[planned_action, rescue_strategy]
  end

  combine_suggested_strategies(suggested_strategies)
end