def setup_redis
      @logger.debug("connecting to redis", :settings => @settings[:redis])
      Redis.logger = @logger
      Redis.connect(@settings[:redis]) do |connection|
        @redis = connection
        @redis.on_error do |error|
          @logger.error("redis connection error", :error => error.to_s)
        end
        @redis.before_reconnect do
          unless testing?
            @logger.warn("reconnecting to redis")
            pause
          end
        end
        @redis.after_reconnect do
          @logger.info("reconnected to redis")
          resume
        end
        yield(@redis) if block_given?
      end
    end
def setup_redis
      @logger.debug("connecting to redis", :settings => @settings[:redis])
      Redis.logger = @logger
      Redis.connect(@settings[:redis]) do |connection|
        @redis = connection
        @redis.on_error do |error|
          @logger.error("redis connection error", :error => error.to_s)
        end
        @redis.before_reconnect do
          unless testing?
            @logger.warn("reconnecting to redis")
            pause
          end
        end
        @redis.after_reconnect do
          @logger.info("reconnected to redis")
          resume
        end
        yield(@redis) if block_given?
      end
    end
Set up the Redis connection. Sensu uses Redis as a data store,
 to store the client registry, current events, etc. The Sensu
 service will stop gracefully in the event of a Redis error, and
 pause/resume in the event of connectivity issues. This method
 creates the Redis instance variable: `@redis`.

 https://github.com/sensu/sensu-redis

 @yield [Object] passes initialized and connected Redis
   connection object to the callback/block.