Skip to content

Commit

Permalink
Fixed bug when timeout is not None when creating a pool (#166).
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-tuininga committed Apr 21, 2023
1 parent 325f108 commit 569d5a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Thin Mode Changes

#) Fixed bug when SQL is executed after first being parsed with Oracle
Database 23c.
#) Fixed bug when timeout is not ``None`` when creating a pool
(`issue 166 <https://github.com/oracle/python-oracledb/issues/166>`__).
#) Replaced regular expressions for parsing SQL with regular expressions that
perform better
(`issue 172 <https://github.com/oracle/python-oracledb/issues/172>`__).
Expand Down
7 changes: 4 additions & 3 deletions src/oracledb/impl/thin/pool.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,10 @@ cdef class ThinPoolImpl(BasePoolImpl):
current_time = time.monotonic()
while self.get_open_count() > self.min and conn_impls_to_check:
conn_impl = conn_impls_to_check[0]
if current_time - conn_impl._time_in_pool > self._timeout:
conn_impls_to_check.pop(0)
self._drop_conn_impl(conn_impl)
if current_time - conn_impl._time_in_pool < self._timeout:
break
conn_impls_to_check.pop(0)
self._drop_conn_impl(conn_impl)

def acquire(self, ConnectParamsImpl params):
"""
Expand Down

0 comments on commit 569d5a3

Please sign in to comment.