diff --git a/irods/pool.py b/irods/pool.py index a399be6c..12b6f7f6 100644 --- a/irods/pool.py +++ b/irods/pool.py @@ -82,7 +82,7 @@ def _conn(self, conn_): def get_connection(self): new_conn = False with self._lock: - try: + if self.idle: conn = self.idle.pop() curr_time = datetime.datetime.now() @@ -105,7 +105,7 @@ def get_connection(self): conn = Connection(self, self.account) new_conn = True logger.debug(f"Created new connection with id: {id(conn)}") - except KeyError: + else: conn = Connection(self, self.account) new_conn = True logger.debug(f"No connection found in idle set. Created a new connection with id: {id(conn)}")