lib/makara/pool.rb
# Provide a connection that is not blacklisted and connected. Handle any errors
# that may occur within the block.
Provide a connection that is not blacklisted and connected. Handle any errors
that may occur within the block.
Provide a connection that is not blacklisted and connected . Handle any errors that may occur within the block .
def provide
      provided_connection = self.next
      if provided_connection
        value = @proxy.error_handler.handle(provided_connection) do
          yield provided_connection
        end
        @blacklist_errors = []
        value
      elsif connection_made?
        err = Makara::Errors::AllConnectionsBlacklisted.new(self, @blacklist_errors)
        @blacklist_errors = []
        raise err
      else
        raise Makara::Errors::NoConnectionsAvailable.new(@role) unless @disabled
      end
    rescue Makara::Errors::BlacklistConnection => e
      @blacklist_errors.insert(0, e)
      provided_connection._makara_blacklist!
      retry
    end
def provide provided_connection = self . next if provided_connection value = @proxy . error_handler . handle ( provided_connection ) do yield provided_connection end @blacklist_errors = [ ] value elsif connection_made? err = Makara :: Errors :: AllConnectionsBlacklisted . new ( self , @blacklist_errors ) @blacklist_errors = [ ] raise err else raise Makara :: Errors :: NoConnectionsAvailable . new ( @role ) unless @disabled end rescue Makara :: Errors :: BlacklistConnection => e @blacklist_errors . insert ( 0 , e ) provided_connection . _makara_blacklist! retry end
Provide a connection that is not blacklisted and connected.
Provide a connection that is not blacklisted and connected .
# nil implies that it's blacklisted # if we've made any connections within this pool, we should report the blackout. # when a connection causes a blacklist error within the provided block, we blacklist it then retry