]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
put status printing in log function
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 16 Sep 2005 02:18:05 +0000 (02:18 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 16 Sep 2005 02:18:05 +0000 (02:18 +0000)
lib/sqlalchemy/pool.py

index 8d231058f6a32f1ddb611677632f5da001ddd6a3..554fefdd1eb490b6d541eed10239643f38b08175 100644 (file)
@@ -41,6 +41,10 @@ def manage(module, **params):
 def clear_managers():
     """removes all current DBAPI2 managers.  all pools and connections are disposed."""
     proxies.clear()
+
+def status(pool):
+    tup = (pool.size(), pool.checkedin(), pool.overflow(), pool.checkedout())
+    return "Pool size: %d  Connections in pool: %d Current Overflow: %d Current Checked out connections: %d" % tup
     
 class Pool(object):
     def __init__(self, echo = False, use_threadlocal = True):
@@ -107,6 +111,7 @@ class QueuePool(Pool):
     def get(self):
         if self._echo:
             self.log("get connection from pool")
+            self.log(status(self))
         try:
             return self._pool.get(self._max_overflow > -1 and self._overflow >= self._max_overflow)
         except Queue.Empty: