diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-03-22 18:45:39 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-03-22 18:45:39 -0400 |
commit | eed9cfc3ae027f21a1f46a6e07fcef0724741eb2 (patch) | |
tree | 5cffcebebd3e7561fd4102709910d6e194f21830 /test/engine/test_reconnect.py | |
parent | be3c185fd48c2abcc5d9f54dd0c415e15c33184f (diff) | |
download | sqlalchemy-eed9cfc3ae027f21a1f46a6e07fcef0724741eb2.tar.gz |
- A major improvement made to the mechanics by which the :class:`.Engine`
recycles the connection pool when a "disconnect" condition is detected;
instead of discarding the pool and explicitly closing out connections,
the pool is retained and a "generational" timestamp is updated to
reflect the current time, thereby causing all existing connections
to be recycled when they are next checked out. This greatly simplifies
the recycle process, removes the need for "waking up" connect attempts
waiting on the old pool and eliminates the race condition that many
immediately-discarded "pool" objects could be created during the
recycle operation. fixes #2985
Diffstat (limited to 'test/engine/test_reconnect.py')
-rw-r--r-- | test/engine/test_reconnect.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/engine/test_reconnect.py b/test/engine/test_reconnect.py index ba336a1bf..a3ad9c548 100644 --- a/test/engine/test_reconnect.py +++ b/test/engine/test_reconnect.py @@ -146,16 +146,20 @@ class MockReconnectTest(fixtures.TestBase): # close shouldnt break conn.close() - is_not_(self.db.pool, db_pool) - - # ensure all connections closed (pool was recycled) + # ensure one connection closed... eq_( [c.close.mock_calls for c in self.dbapi.connections], - [[call()], [call()]] + [[call()], []] ) conn = self.db.connect() + + eq_( + [c.close.mock_calls for c in self.dbapi.connections], + [[call()], [call()], []] + ) + conn.execute(select([1])) conn.close() @@ -534,8 +538,6 @@ class RealReconnectTest(fixtures.TestBase): # invalidate() also doesn't screw up assert_raises(exc.DBAPIError, engine.connect) - # pool was recreated - assert engine.pool is not p1 def test_null_pool(self): engine = \ |