Class: Parallizer::Worker

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/parallizer/worker.rb

Instance Method Summary collapse

Instance Method Details

#run(client, method_name, args, options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/parallizer/worker.rb', line 7

def run(client, method_name, args, options)
  result = {}
  
  (options[:retries] + 1).times do
    begin
      result[:exception] = nil # reset exception before each send attempt
      result[:result] = client.send(method_name, *args)
      break # success
    rescue Exception => e
      result[:exception] = e
    end
  end
  
  result
end