]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Note time passage requirement for pool.invalidate()
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Dec 2019 19:10:36 +0000 (14:10 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 31 Dec 2019 01:36:38 +0000 (20:36 -0500)
commitbf01049d0f84a23466bdc140208e55c08e1fa46c
treec0d7fc67af80ad213ffcbeb64a1a1f450b6d6d3e
parenta9d4dec1e5dfec82213d893cad2a1185b23b0c88
Note time passage requirement for pool.invalidate()

For Windows, time.time() may only have 16 millisecond
accuracy, so invalidation routines which compare
the time.time() of invalidate() to the time.time() when
the ConnectionRecord last connected may fail in a unit test
environment that does not pause at least this much time
since the ConnectionRecord startup.  Using >= for comparison
instead of > was considered but this only leads to more confusing
results as the ConnecitonRecord goes into a re-connect loop
as time continues to not pass.

Overall, while using routines such as Python 3.7's time_ns()
might be helpful, for now make sure tests which rely on this
are marked under timing intensive and add small sleeps.

Change-Id: I1a7162e67912d22c135fa517b687a073f8fd9151
(cherry picked from commit f1a22596e2283371f2216245ac4b7ff9a0fb6a9a)
lib/sqlalchemy/pool/base.py
test/engine/test_pool.py