module Bones::RPC::Failover::Retry

Retry is for the case when we get exceptions around the connection, and want to make another attempt to try and resolve the issue.

@since 0.0.1

Public Instance Methods

execute(exception, node) { || ... } click to toggle source

Executes the failover strategy. In the case of retyr, we disconnect and reconnect, then try the operation one more time.

@example Execute the retry strategy.

Bones::RPC::Failover::Retry.execute(exception, node)

@param [ Exception ] exception The raised exception. @param [ Node ] node The node the exception got raised on.

@raise [ Errors::ConnectionFailure ] If the retry fails.

@return [ Object ] The result of the block yield.

@since 0.0.1

# File lib/bones/rpc/failover/retry.rb, line 27
def execute(exception, node)
  node.disconnect
  begin
    yield if block_given?
  rescue Exception => e
    node.down
    raise(e)
  end
end