Retry to connect to deCONZ.
17783
def retry(self):
        """"""
        self.state = STATE_STARTING
        self.loop.call_later(RETRY_TIMER, self.start)
        _LOGGER.debug('Reconnecting to deCONZ in %i.', RETRY_TIMER)
314584
function tryReconnect() {
    self.retry.retries++;
    if (self.retry.retries >= self.retry.max) {
      return self.emit('error', new Error('Did not reconnect after maximum retries: ' + self.retry.max));
    }

    doReconnect();
  }
123236
function retry(err) {
    if (currentAttempt >= retryCount) {
      return callback(err, null, currentAttempt);
    }

    currentAttempt += 1;

    // Since the currentAttempt starts at 1 and it was just incremented
    // currentAttempt - 2 will be the actual timeout index.
    return setTimeout(attempt, timeouts[currentAttempt - 2]);
  }
1345226
def retry(self, func, partition_id, retry_message, final_failure_message, max_retries, host_id):
        
        loop = asyncio.new_event_loop()
        loop.run_until_complete(self.retry_async(func, partition_id, retry_message,
                                                 final_failure_message, max_retries, host_id))
380752
def __retry_session(self, retries=10, backoff_factor=0.3,
                        status_forcelist=(500, 502, 504),
                        session=None):
        

        # requests.Session allows finer control, which is needed to use the
        # retrying code
        the_session = session or requests.Session()

        # The Retry object manages the actual retrying
        retry = Retry(total=retries, read=retries, connect=retries,
                      backoff_factor=backoff_factor,
                      status_forcelist=status_forcelist)

        adapter = HTTPAdapter(max_retries=retry)

        the_session.mount('http://', adapter)
        the_session.mount('https://', adapter)

        return the_session
530786
function doReconnect() {
    //
    // Cleanup and recreate the socket associated
    // with this instance.
    //
    self.retry.waiting = true;
    self.socket.removeAllListeners();
    self.socket = common.createSocket(self._options);

    //
    // Cleanup reconnect logic once the socket connects
    //
    self.socket.once('connect', function () {
      self.retry.waiting = false;
      self.retry.retries = 0;
    });

    //
    // Attempt to reconnect the socket
    //
    self._setup();
    self.connect();
  }
86162
def _retry(function):
        

        def inner(self, **kwargs):
            last_exception = None
            #for host in self.router.get_hosts(**kwargs):
            for host in self.host:
                try:
                    return function(self, host, **kwargs)
                except SolrError as e:
                    self.logger.exception(e)
                    raise
                except ConnectionError as e:
                    self.logger.exception("Tried connecting to Solr, but couldn't because of the following exception.")
                    if '401' in e.__str__():
                        raise
                    last_exception = e
            # raise the last exception after contacting all hosts instead of returning None
            if last_exception is not None:
                raise last_exception
        return inner
1094483
def reconnect(self):
        """"""
        try:
            self.conn.close()
        except Exception,e:
            self.logger.warn(e)

        self.createConnection()

        return True
273844
async def reboot():
    """"""
    async with aiohttp.ClientSession() as session:
        ghlocalapi = DeviceSettings(LOOP, session, IPADDRESS)
        result = await ghlocalapi.reboot()

        print("Reboot info:", result)
858664
function (err) {
      log.error("Redis client closed " + (err ? err.message : ''));
      this.connected = false;
      this.emit('close', err);
      this.backoff.reset();
      this.backoff.backoff();
    }
1254657
def retry_on_excs(excs, retry_count=3, delay=5):
    

    def wrapper(f):
        @functools.wraps(f)
        def deco(*args, **kwargs):
            for i in range(0, retry_count):
                try:
                    return f(*args, **kwargs)
                except excs:
                    if logger:
                        logger.warning(
                            'HTTPError caught.Retrying ...'.format(f.__name__),
                            exc_info=True
                        )
                    time.sleep(delay)
            else:
                logger.error(
                    '{} failed after {} retries'.format(
                        f.__name__, retry_count)
                )
            return f(*args, **kwargs)

        return deco

    return wrapper
1096166
def reconnect
      tries = 0
      begin
        redis.synchronize do |client|
          client.reconnect
        end
      rescue Redis::BaseConnectionError
        if (tries += 1) <= 3
          log "Error reconnecting to Redis; retrying"
          sleep(tries)
          retry
        else
          log "Error reconnecting to Redis; quitting"
          raise
        end
      end
    end
840709
async def reconnect(self):
        """"""
        _LOGGER.debug('starting Connection.reconnect')
        await self._connect()
        while self._closed:
            await self._retry_connection()
        _LOGGER.debug('ending Connection.reconnect')
1210863
def _show_retry_warning(host):
        
        sys.stderr.write("\nConnection to {} failed. Retrying.\n".format(host))
        sys.stderr.flush()
1281979
def _reconnect(self, errorState):
        
        def connect():
            if self.noisy:
                log.msg("Reconnecting now.")
            self.connect()

        backOff = self.backOffs[errorState]

        if self._errorState != errorState or self._delay is None:
            self._errorState = errorState
            self._delay = backOff['initial']
        else:
            self._delay = min(backOff['max'], self._delay * backOff['factor'])

        if self._delay == 0:
            connect()
        else:
            self._reconnectDelayedCall = self.reactor.callLater(self._delay,
                                                                connect)
            self._toState('waiting')
632830
async def reboot(self):
        """"""
        endpoint = '/setup/reboot'
        url = API.format(ip=self._ipaddress, endpoint=endpoint)
        data = {'params': 'now'}
        returnvalue = False
        try:
            async with async_timeout.timeout(5, loop=self._loop):
                result = await self._session.post(url, json=data,
                                                  headers=HEADERS)
                if result.status == 200:
                    returnvalue = True
        except (asyncio.TimeoutError,
                aiohttp.ClientError, socket.gaierror) as error:
            _LOGGER.error('Error connecting to GHLocalApi, %s', error)
        return returnvalue
1287232
def connect_with_retry(self) -> None:
        
        if self.is_connected():
            log.debug('Already connected to the Slack API')
            return

        for retry in range(1, self.retries + 1):
            self.connect()
            if self.is_connected():
                log.debug('Connected to the Slack API')
                return
            else:
                interval = self.backoff(retry)
                log.debug("Waiting %.3fs before retrying", interval)
                time.sleep(interval)

        raise FailedConnection('Failed to connect to the Slack API')