# File lib/redis/client.rb, line 545
        def sentinel_detect
          @sentinels.each do |sentinel|
            client = Client.new(@options.merge({
              :host => sentinel[:host],
              :port => sentinel[:port],
              :reconnect_attempts => 0,
            }))

            begin
              if result = yield(client)
                # This sentinel responded. Make sure we ask it first next time.
                @sentinels.delete(sentinel)
                @sentinels.unshift(sentinel)

                return result
              end
            rescue BaseConnectionError
            ensure
              client.disconnect
            end
          end

          raise CannotConnectError, "No sentinels available."
        end