Module: Moped::Failover::Retry
Overview
Retry is for the case when we get exceptions around the connection, and want to make another attempt to try and resolve the issue.
Instance Method Summary collapse
-
#execute(exception, node) ⇒ Object
Executes the failover strategy.
Instance Method Details
#execute(exception, node) ⇒ Object
Executes the failover strategy. In the case of retry, we disconnect and reconnect, then try the operation one more time.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/moped/failover/retry.rb', line 26 def execute(exception, node) node.disconnect unless exception.is_a?(Errors::PoolTimeout) begin node.connection do |conn| yield(conn) if block_given? end rescue Errors::PoolTimeout => e raise Errors::ConnectionFailure.new e rescue Exception => e node.down! raise(e) end end |