diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-07-04 13:18:00 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-07-04 13:18:00 -0400 |
| commit | f390639bf1a7a5a2a47bcd6df7106cf5855a44c1 (patch) | |
| tree | c907a2683dfa4e8ad05be2ad2730cabe8a031743 /lib/sqlalchemy/pool.py | |
| parent | 82f5ff7938d002a3cd67d43af04f77ce3daa8b71 (diff) | |
| download | sqlalchemy-f390639bf1a7a5a2a47bcd6df7106cf5855a44c1.tar.gz | |
Fixed bug where :class:`.QueuePool` would lose the correct
checked out count if an existing pooled connection failed to reconnect
after an invalidate or recycle event. Also in 0.8.3.
[ticket:2772]
Diffstat (limited to 'lib/sqlalchemy/pool.py')
| -rw-r--r-- | lib/sqlalchemy/pool.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index 97411dd3a..498b001c1 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -328,7 +328,11 @@ class _ConnectionRecord(object): @classmethod def checkout(cls, pool): rec = pool._do_get() - dbapi_connection = rec.get_connection() + try: + dbapi_connection = rec.get_connection() + except: + rec.checkin() + raise fairy = _ConnectionFairy(dbapi_connection, rec) rec.fairy_ref = weakref.ref( fairy, @@ -565,6 +569,7 @@ class _ConnectionFairy(object): _refs.remove(self._connection_record) self._connection_record.fairy_ref = None self._connection_record.connection = None + # TODO: should this be _return_conn? self._pool._do_return_conn(self._connection_record) self.info = self.info.copy() self._connection_record = None |
