def ensure_connected!(max_retries = 4, retry_delay = 1.0)
      return self if connected?

      begin
        reconnect!
        return self

      rescue Beaneater::NotConnected => e
        if max_retries > 0
          max_retries -= 1
          sleep retry_delay
          retry
        else # stop retrying
          raise e
        end
      end
    end
def ensure_connected!(max_retries = 4, retry_delay = 1.0)
      return self if connected?

      begin
        reconnect!
        return self

      rescue Beaneater::NotConnected => e
        if max_retries > 0
          max_retries -= 1
          sleep retry_delay
          retry
        else # stop retrying
          raise e
        end
      end
    end
Attempts to ensure a connection to beanstalk is established but only if
 we're not connected already
 @param max_retries Integer The maximum number of times to attempt connecting. Defaults to 4
 @param retry_delay Float   The time to wait between retrying to connect. Defaults to 1.0
 @raise [Beaneater::NotConnected] If beanstalk fails to connect after multiple attempts.
 @return Connection This Connection is returned if the connection to beanstalk is open or was able to be reconnected