Sha256: fb9d218b137895abcf540efba55de17240ab980116da65535b8291b71679d4bc
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
# encoding: utf-8 module Moped module Failover # 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 2.0.0 module Retry extend self # Executes the failover strategy. In the case of retry, we disconnect and # reconnect, then try the operation one more time. # # @example Execute the retry strategy. # Moped::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 2.0.0 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 end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
ish_lib_manager-0.0.1 | test/dummy/vendor/bundle/ruby/2.3.0/bundler/gems/moped-cf817ca58a85/lib/moped/failover/retry.rb |
moped-2.0.7 | lib/moped/failover/retry.rb |