Commits

Mike Bayer committed 776c9cb

fixes to pool_invalidate [ticket:224]

Comments (0)

Files changed (2)

 - new MySQL types: MSEnum, MSTinyText, MSMediumText, MSLongText, etc.
 more support for MS-specific length/precision params in numeric types
 patch courtesy Mike Bernson
+- some fixes to connection pool invalidate() [ticket:224]
 
 0.2.3
 - overhaul to mapper compilation to be deferred.  this allows mappers

lib/sqlalchemy/pool.py

             self._threadconns[thread.get_ident()] = agent
             return agent
 
-    def return_conn(self, agent):
+    def _purge_for_threadlocal(self):
         if self._use_threadlocal:
             try:
                 del self._threadconns[thread.get_ident()]
             except KeyError:
                 pass
+
+    def return_conn(self, agent):
+        self._purge_for_threadlocal()
         self.do_return_conn(agent.connection)
+
+    def return_invalid(self):
+        self._purge_for_threadlocal()
+        self.do_return_invalid()
         
     def get(self):
         return self.do_get()
     
-    def return_invalid(self):
-        self.do_return_invalid()
-            
     def do_get(self):
         raise NotImplementedError()
         
     def invalidate(self):
         if self.pool.echo:
             self.pool.log("Invalidate connection %s" % repr(self.connection))
-        self.connection.rollback()
         self.connection = None
         self.pool.return_invalid()
     def cursor(self, *args, **kwargs):
             self._overflow -= 1
 
     def do_return_invalid(self):
-        if self._pool.full():
-            self._overflow -= 1
+        self._overflow -= 1
         
     def do_get(self):
         try:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.