Sha256: 6194d234eaba64ccd6d363616491a70c62014434b96f97cc492324747ef8e810

Contents?: true

Size: 951 Bytes

Versions: 17

Compression:

Stored size: 951 Bytes

Contents

# encoding: utf-8
module Moped
  module Failover

    # Disconnect is for the case when we get exceptions we do not know about,
    # and need to disconnect the node to cleanup the problem.
    #
    # @since 2.0.0
    module Disconnect
      extend self

      # Executes the failover strategy. In the case of disconnect, we just re-raise
      # the exception that was thrown previously extending a socket error and
      # disconnect.
      #
      # @example Execute the disconnect strategy.
      #   Moped::Failover::Disconnect.execute(exception, node)
      #
      # @param [ Exception ] exception The raised exception.
      # @param [ Node ] node The node the exception got raised on.
      #
      # @raise [ Errors::SocketError ] The extended exception that was thrown.
      #
      # @since 2.0.0
      def execute(exception, node)
        node.disconnect
        raise(exception.extend(Errors::SocketError))
      end
    end
  end
end

Version data entries

17 entries across 17 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/disconnect.rb
moped-2.0.7 lib/moped/failover/disconnect.rb
moped-2.0.6 lib/moped/failover/disconnect.rb
moped-2.0.5 lib/moped/failover/disconnect.rb
moped-2.0.4 lib/moped/failover/disconnect.rb
moped-2.0.3 lib/moped/failover/disconnect.rb
moped-2.0.2 lib/moped/failover/disconnect.rb
moped-2.0.1 lib/moped/failover/disconnect.rb
moped-2.0.0 lib/moped/failover/disconnect.rb
moped-2.0.0.rc2 lib/moped/failover/disconnect.rb
moped-2.0.0.rc1 lib/moped/failover/disconnect.rb
moped-2.0.0.beta6 lib/moped/failover/disconnect.rb
moped-2.0.0.beta5 lib/moped/failover/disconnect.rb
moped-2.0.0.beta4 lib/moped/failover/disconnect.rb
moped-2.0.0.beta3 lib/moped/failover/disconnect.rb
moped-2.0.0.beta2 lib/moped/failover/disconnect.rb
moped-2.0.0.beta lib/moped/failover/disconnect.rb