diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-10-07 08:42:48 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2020-10-07 09:14:13 -0400 |
commit | 0220b58917b5a979891b5765f6ac5095e0368489 (patch) | |
tree | 2c914e75af50484b8e88603cfeab418e900fe4f2 /test/engine/test_pool.py | |
parent | fc643ae73009e91e2dcff9ef57fb7dc0e48df88b (diff) | |
download | sqlalchemy-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.py | 2 |
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( |