Module: Humanoid::Collections::Mimic::InstanceMethods

Defined in:
lib/humanoid/collections/mimic.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#attempt(operation, start) ⇒ Object

Retry the supplied operation until the reconnect time has expired, defined in the humanoid Config module.

Example:

master.attempt(operation)



19
20
21
22
23
24
25
26
# File 'lib/humanoid/collections/mimic.rb', line 19

def attempt(operation, start)
  begin
    elapsed = (Time.now - start)
    operation.call
  rescue Mongo::ConnectionFailure => error
    (elapsed < Humanoid.reconnect_time) ? retry : (raise error)
  end
end