Module: EMRetryMethod

Defined in:
lib/em_retry.rb

Overview

A convenience wrapper for existing methods to indicate they should be executed in a EM.with_retries block.

Instance Method Summary collapse

Instance Method Details

#retry_method(meth, *timers) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/em_retry.rb', line 23

def retry_method(meth, *timers)
  orig_method = instance_method(meth)
  
  define_method meth do |*args, &block|
    EM.with_retries *timers do
      orig_method.bind(self).call *args, &block
    end
  end
end