diff options
author | Zuul <zuul@review.opendev.org> | 2021-03-10 19:05:27 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2021-03-10 19:05:27 +0000 |
commit | 3f6fa2da29a6eb598702ce5dc3b65c80484b1b4a (patch) | |
tree | e30211d62b93a74aededcd7d49ea62be6253c587 | |
parent | 089471c8fbe655ae1e519fb415394aa9485a6554 (diff) | |
parent | 8a76de29e1ceebcde517c6491de190de4e005303 (diff) | |
download | gear-3f6fa2da29a6eb598702ce5dc3b65c80484b1b4a.tar.gz |
Merge "Modify connection timeout process"
-rw-r--r-- | gear/__init__.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/gear/__init__.py b/gear/__init__.py index f7fc767..534f0f8 100644 --- a/gear/__init__.py +++ b/gear/__init__.py @@ -1250,15 +1250,18 @@ class BaseClient(BaseClientServer): start_time = time.time() while self.running: self.connections_condition.acquire() - while self.running and not self.active_connections: - if timeout is not None: - self._checkTimeout(start_time, timeout) - self.log.debug("Waiting for at least one active connection") - self.connections_condition.wait(timeout=1) - if self.active_connections: - self.log.debug("Active connection found") - connected = True - self.connections_condition.release() + try: + while self.running and not self.active_connections: + if timeout is not None: + self._checkTimeout(start_time, timeout) + self.log.debug("Waiting for at least one active " + "connection") + self.connections_condition.wait(timeout=1) + if self.active_connections: + self.log.debug("Active connection found") + connected = True + finally: + self.connections_condition.release() if connected: return |