]> 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>
Fri, 27 Dec 2019 19:10:36 +0000 (14:10 -0500)
commitf1a22596e2283371f2216245ac4b7ff9a0fb6a9a
tree8562df8283a74c13fea539ae90fae252c27a8ba0
parent60e7034a7423955cd89d5624f8769d3804ca6d82
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
lib/sqlalchemy/pool/base.py
test/engine/test_pool.py