def _get_client(self, key): _check_key(key, self.allow_unicode_keys, self.key_prefix) if len(self._dead_clients) > 0: current_time = time.time() ldc = self._last_dead_check_time # we have dead clients and we have reached the # timeout retry if current_time - ldc > self.dead_timeout: for server, dead_time in self._dead_clients.items(): if current_time - dead_time > self.dead_timeout: logger.debug( 'bringing server back into rotation %s', server ) self.add_server(*server) self._last_dead_check_time = current_time server = self.hasher.get_node(key) # We've ran out of servers to try if server is None: if self.ignore_exc is True: return raise MemcacheError('All servers seem to be down right now') client = self.clients[server] return client
def _get_client(self, key): _check_key(key, self.allow_unicode_keys, self.key_prefix) if len(self._dead_clients) > 0: current_time = time.time() ldc = self._last_dead_check_time # we have dead clients and we have reached the # timeout retry if current_time - ldc > self.dead_timeout: for server, dead_time in self._dead_clients.items(): if current_time - dead_time > self.dead_timeout: logger.debug( 'bringing server back into rotation %s', server ) self.add_server(*server) self._last_dead_check_time = current_time server = self.hasher.get_node(key) # We've ran out of servers to try if server is None: if self.ignore_exc is True: return raise MemcacheError('All servers seem to be down right now') client = self.clients[server] return client
def _get_client(self, key): _check_key(key, self.key_prefix) if len(self._dead_clients) > 0: current_time = time.time() ldc = self._last_dead_check_time # we have dead clients and we have reached the # timeout retry if current_time - ldc > self.dead_timeout: for server, dead_time in self._dead_clients.items(): if current_time - dead_time > self.dead_timeout: logger.debug( 'bringing server back into rotation %s', server ) self.add_server(*server) self._last_dead_check_time = current_time server = self.hasher.get_node(key) client = self.clients[server] return client