def with_failover #:nodoc:
      end_time = Time.now.to_i + @config.redis_failover_timeout.to_i
      begin
        yield
      rescue Exception => e
        Beetle::reraise_expectation_errors!
        logger.error "Beetle: redis connection error #{e} #{@config.redis_server} (#{e.backtrace[0]})"
        if Time.now.to_i < end_time
          sleep 1
          logger.info "Beetle: retrying redis operation"
          retry
        else
          raise NoRedisMaster.new(e.to_s)
        end
      end
    end
def with_failover #:nodoc:
      end_time = Time.now.to_i + @config.redis_failover_timeout.to_i
      begin
        yield
      rescue Exception => e
        Beetle::reraise_expectation_errors!
        logger.error "Beetle: redis connection error #{e} #{@config.redis_server} (#{e.backtrace[0]})"
        if Time.now.to_i < end_time
          sleep 1
          logger.info "Beetle: retrying redis operation"
          retry
        else
          raise NoRedisMaster.new(e.to_s)
        end
      end
    end
performs redis operations by yielding a passed in block, waiting for a new master to
 show up on the network if the operation throws an exception. if a new master doesn't
 appear after the configured timeout interval, we raise an exception.