Fixed bug that caused "Connection.is_healthy()" to return "True"
after a connection has been killed.
This commit is contained in:
parent
bf4c2ce48d
commit
9db900c31d
|
@ -15,6 +15,8 @@ Thin Mode Changes
|
|||
|
||||
#) Fixed bug that prevented binding data of types DB_TYPE_ROWID and
|
||||
DB_TYPE_UROWID.
|
||||
#) Fixed bug that caused :meth:`Connection.is_healthy()` to return `True`
|
||||
after a connection has been killed.
|
||||
#) Internally, before a connection is returned from a pool, perform additional
|
||||
checks in order to avoid returning a dead connection from the pool.
|
||||
|
||||
|
|
|
@ -503,7 +503,7 @@ class Connection:
|
|||
This function performs a local check. To fully check a connection's
|
||||
health, use ping() which performs a round-trip to the database.
|
||||
"""
|
||||
return self._impl.get_is_healthy()
|
||||
return self._impl is not None and self._impl.get_is_healthy()
|
||||
|
||||
@property
|
||||
def ltxid(self) -> bytes:
|
||||
|
|
|
@ -325,7 +325,8 @@ cdef class ThinConnImpl(BaseConnImpl):
|
|||
return self._internal_name
|
||||
|
||||
def get_is_healthy(self):
|
||||
return not self._protocol._read_buf._session_needs_to_be_closed
|
||||
return self._protocol._socket is not None \
|
||||
and not self._protocol._read_buf._session_needs_to_be_closed
|
||||
|
||||
def get_ltxid(self):
|
||||
return self._ltxid or b''
|
||||
|
|
|
@ -739,6 +739,7 @@ class TestCase(test_env.BaseTestCase):
|
|||
admin_cursor.execute(sql)
|
||||
self.assertRaisesRegex(oracledb.DatabaseError, "^DPY-4011:",
|
||||
cursor.execute, "select user from dual")
|
||||
self.assertFalse(conn.is_healthy())
|
||||
|
||||
def test_4359_kill_conn_in_context_manager(self):
|
||||
"4359 - kill connection in cursor context manager"
|
||||
|
|
Loading…
Reference in New Issue