]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
Integrate "pre-ping" into connection pool.
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 24 Feb 2017 15:50:14 +0000 (10:50 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 20 Mar 2017 22:01:23 +0000 (18:01 -0400)
commitf881dae8179b94f72ab0dc85d8f62be8c9ce2fe0
tree5cb60158bc13584b5350b9d7f87604d1e0b4350a
parent9e06ab17b9d3083cd45540f714234d1d5826da32
Integrate "pre-ping" into connection pool.

Added native "pessimistic disconnection" handling to the :class:`.Pool`
object.  The new parameter :paramref:`.Pool.pre_ping`, available from
the engine as :paramref:`.create_engine.pool_pre_ping`, applies an
efficient form of the "pre-ping" recipe featured in the pooling
documentation, which upon each connection check out, emits a simple
statement, typically "SELECT 1", to test the connection for liveness.
If the existing connection is no longer able to respond to commands,
the connection is transparently recycled, and all other connections
made prior to the current timestamp are invalidated.

Change-Id: I89700d0075e60abd2250e54b9bd14daf03c71c00
Fixes: #3919
doc/build/changelog/changelog_12.rst
doc/build/changelog/migration_12.rst
doc/build/core/pooling.rst
lib/sqlalchemy/engine/__init__.py
lib/sqlalchemy/engine/default.py
lib/sqlalchemy/engine/strategies.py
lib/sqlalchemy/exc.py
lib/sqlalchemy/pool.py
lib/sqlalchemy/testing/engines.py
test/engine/test_reconnect.py