Class: Kuroko2::Workflow::Task::Retry

Inherits:
Base
  • Object
show all
Defined in:
lib/autoload/kuroko2/workflow/task/retry.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Kuroko2::Workflow::Task::Base

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/autoload/kuroko2/workflow/task/retry.rb', line 5

def execute
  retry_option = parse_option(option)
  token.context['RETRY'] ||= {}
  node.children.each do |child|
    token.context['RETRY'][child.path] = {
      retried_count: 0,
      count: retry_option['count'].to_i,
      sleep_time: retry_option['sleep_time'].to_i
    }
  end

  :next
end

#validateObject



19
20
21
22
23
24
25
# File 'lib/autoload/kuroko2/workflow/task/retry.rb', line 19

def validate
  retry_option = parse_option(option)

  unless retry_option.has_key?("count")
    raise Workflow::AssertionError, "Syntax error option value of retry: #{option} [count option is required]"
  end
end