]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
critical fix to r5028 repairs SingleThreadPool to return a connection in case one...
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 27 Aug 2008 05:58:18 +0000 (05:58 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 27 Aug 2008 05:58:18 +0000 (05:58 +0000)
lib/sqlalchemy/pool.py

index c0d98ffc471ab982f4b27d4c86869ea7cb3722e1..c2a150d3321bf7a75aa161125f2466b505f11e60 100644 (file)
@@ -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.