summaryrefslogtreecommitdiff
path: root/test/engine/test_pool.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-10-07 08:42:48 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-10-07 09:14:13 -0400
commit0220b58917b5a979891b5765f6ac5095e0368489 (patch)
tree2c914e75af50484b8e88603cfeab418e900fe4f2 /test/engine/test_pool.py
parentfc643ae73009e91e2dcff9ef57fb7dc0e48df88b (diff)
downloadsqlalchemy-0220b58917b5a979891b5765f6ac5095e0368489.tar.gz
Use monotonic time for pool age measurement
The internal clock used by the :class:`_pool.Pool` object is now time.monotonic_time() under Python 3. Under Python 2, time.time() is still used, which is legacy. This clock is used to measure the age of a connection against its starttime, and used in comparisons against the pool_timeout setting as well as the last time the pool was marked as invalid to determine if the connection should be recycled. Previously, time.time() was used which was subject to inaccuracies as a result of system clock changes as well as poor time resolution on windows. Change-Id: I94f90044c1809508e26a5a00134981c2a00d0405
Diffstat (limited to 'test/engine/test_pool.py')
-rw-r--r--test/engine/test_pool.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/engine/test_pool.py b/test/engine/test_pool.py
index eb705da61..e01609b17 100644
--- a/test/engine/test_pool.py
+++ b/test/engine/test_pool.py
@@ -1241,7 +1241,7 @@ class QueuePoolTest(PoolTestBase):
)
def test_recycle(self):
- with patch("sqlalchemy.pool.base.time.time") as mock:
+ with patch("sqlalchemy.pool.base.monotonic_time") as mock:
mock.return_value = 10000
p = self._queuepool_fixture(