def reconnect_from(*exceptions)
      begin
        yield
      rescue *exceptions => ex
        if @reconnect
          logger.debug "Connection failed: #{ex.message}"
          EM::Synchrony.sleep(@reconnect_wait)
          logger.debug 'Attempting to reconnect'
          retry
        else
          raise
        end
      end
    end
def reconnect_from(*exceptions)
      begin
        yield
      rescue *exceptions => ex
        if @reconnect
          logger.debug "Connection failed: #{ex.message}"
          EM::Synchrony.sleep(@reconnect_wait)
          logger.debug 'Attempting to reconnect'
          retry
        else
          raise
        end
      end
    end
Runs a given block and retries that block after a certain period of time
 if any of the specified exceptions are raised.  Note that there is no
 limit on the number of attempts to retry.