def check_status
      begin
        if @auth_client && @auth_client.mode != @mode
          Log.info("Detected request to switch mode from #{@mode} to #{@auth_client.mode}")
          update_status(:auth, :failed)
        end
      rescue Exception => e
        ErrorTracker.log(self, "Failed switching mode", e)
      end

      begin
        finish_setup unless @terminating || @mode == :http
      rescue Exception => e
        ErrorTracker.log(self, "Failed finishing setup", e)
      end

      begin
        @client.queue_status(@queues, timeout = @options[:check_interval] / 10) unless @terminating || @mode == :http
      rescue Exception => e
        ErrorTracker.log(self, "Failed checking queue status", e)
      end

      begin
        publish_stats unless @terminating || @stats_routing_key.nil?
      rescue Exception => e
        ErrorTracker.log(self, "Failed publishing stats", e)
      end

      begin
        check_other(@check_status_count) unless @terminating
      rescue Exception => e
        ErrorTracker.log(self, "Failed to perform other check status check", e)
      end

      @check_status_count += 1
      true
    end
def check_status
      begin
        if @auth_client && @auth_client.mode != @mode
          Log.info("Detected request to switch mode from #{@mode} to #{@auth_client.mode}")
          update_status(:auth, :failed)
        end
      rescue Exception => e
        ErrorTracker.log(self, "Failed switching mode", e)
      end

      begin
        finish_setup unless @terminating || @mode == :http
      rescue Exception => e
        ErrorTracker.log(self, "Failed finishing setup", e)
      end

      begin
        @client.queue_status(@queues, timeout = @options[:check_interval] / 10) unless @terminating || @mode == :http
      rescue Exception => e
        ErrorTracker.log(self, "Failed checking queue status", e)
      end

      begin
        publish_stats unless @terminating || @stats_routing_key.nil?
      rescue Exception => e
        ErrorTracker.log(self, "Failed publishing stats", e)
      end

      begin
        check_other(@check_status_count) unless @terminating
      rescue Exception => e
        ErrorTracker.log(self, "Failed to perform other check status check", e)
      end

      @check_status_count += 1
      true
    end
Check status of agent by finishing any queue setup, checking the status of the queues,
 and gathering/publishing current operation statistics
 Checking the status of a queue will cause the broker connection to fail if the
 queue does not exist, but a reconnect should then get initiated on the next check loop
 Although agent termination cancels the check_status_timer, this method could induce
 termination, therefore the termination status needs to be checked before each step

 === Return
 true:: Always return true