def reconnect
      unless @reconnecting
        @reconnecting = true

        if EM.reactor_running?
          @stats["reconnects"].update("initiate")
          @reconnect_timer = EM_S::PeriodicTimer.new(rand(@options[:reconnect_interval])) do
            begin
              reconnect_once
            rescue Exception => e
              ErrorTracker.log(self, "Failed #{@options[:server_name]} reconnect", e, nil, :caller)
              @stats["reconnects"].update("failure")
              self.state = :disconnected
            end
            @reconnect_timer.interval = @options[:reconnect_interval] if @reconnect_timer
          end
        else
          reconnect_once
        end
      end

      true
    end
def reconnect
      unless @reconnecting
        @reconnecting = true

        if EM.reactor_running?
          @stats["reconnects"].update("initiate")
          @reconnect_timer = EM_S::PeriodicTimer.new(rand(@options[:reconnect_interval])) do
            begin
              reconnect_once
            rescue Exception => e
              ErrorTracker.log(self, "Failed #{@options[:server_name]} reconnect", e, nil, :caller)
              @stats["reconnects"].update("failure")
              self.state = :disconnected
            end
            @reconnect_timer.interval = @options[:reconnect_interval] if @reconnect_timer
          end
        else
          reconnect_once
        end
      end

      true
    end
If EventMachine reactor is running, begin attempting to periodically
 reconnect with server by checking health. Randomize initial attempt to
 reduce server spiking.

 If EventMachine reactor is NOT running, attempt to reconnect once
 and raise any exception that is encountered.

 @return [TrueClass] always true