def _get_server(self):
with self._lock:<EOL><INDENT>inactive_server_count = len(self._inactive_servers)<EOL>for i in range(inactive_server_count):<EOL><INDENT>try:<EOL><INDENT>ts, server, message = heapq.heappop(self._inactive_servers)<EOL><DEDENT>except IndexError:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>if (ts + self.retry_interval) > time():<EOL><INDENT>heapq.heappush(self._inactive_servers,<EOL>(ts, server, message))<EOL><DEDENT>else:<EOL><INDENT>self._active_servers.append(server)<EOL>logger.warn("<STR_LIT>",<EOL>server)<EOL><DEDENT><DEDENT><DEDENT>if not self._active_servers:<EOL><INDENT>ts, server, message = heapq.heappop(self._inactive_servers)<EOL>self._active_servers.append(server)<EOL>logger.info("<STR_LIT>", server)<EOL><DEDENT>server = self._active_servers[<NUM_LIT:0>]<EOL>self._roundrobin()<EOL>return server<EOL><DEDENT>
Get server to use for request.
Also process inactive server list, re-add them after given interval.