diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-08-27 05:58:18 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-08-27 05:58:18 +0000 |
| commit | ad6f9325383ee933060105fe71b61ca03049a6b6 (patch) | |
| tree | f708ece49d8d5019e982d7a85d2dacc6f3d031a9 /lib/sqlalchemy/pool.py | |
| parent | dcad710de2cff2ceeef18dbd06eb4b263b8c39ad (diff) | |
| download | sqlalchemy-ad6f9325383ee933060105fe71b61ca03049a6b6.tar.gz | |
critical fix to r5028 repairs SingleThreadPool to return a connection in case one had been removed via cleanup()
Diffstat (limited to 'lib/sqlalchemy/pool.py')
| -rw-r--r-- | lib/sqlalchemy/pool.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py index c0d98ffc4..c2a150d33 100644 --- a/lib/sqlalchemy/pool.py +++ b/lib/sqlalchemy/pool.py @@ -527,14 +527,16 @@ class SingletonThreadPool(Pool): def do_get(self): try: - return self._conn.current() - except AttributeError: - c = self.create_connection() - self._conn.current = weakref.ref(c) - self._all_conns.add(c) - if len(self._all_conns) > self.size: - self.cleanup() + c = self._conn.current() return c + except AttributeError: + pass + c = self.create_connection() + self._conn.current = weakref.ref(c) + self._all_conns.add(c) + if len(self._all_conns) > self.size: + self.cleanup() + return c class QueuePool(Pool): """A Pool that imposes a limit on the number of open connections. |
