[pool] properly close existing connection before reconnection stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 26 Feb 2010 07:58:02 +0100
branchstable
changeset 4710 4d9ad6a4f261
parent 4709 6a71fc0b4274
child 4711 7ef3b029e10b
[pool] properly close existing connection before reconnection
server/pool.py
--- a/server/pool.py	Fri Feb 26 07:44:18 2010 +0100
+++ b/server/pool.py	Fri Feb 26 07:58:02 2010 +0100
@@ -109,6 +109,11 @@
         else:
             sources = (source,)
         for source in sources:
+            try:
+                # properly close existing connection if any
+                self.source_cnxs[source.uri][1].close()
+            except:
+                pass
             source.info('trying to reconnect')
             self.source_cnxs[source.uri] = (source, source.get_connection())
             self._cursors.pop(source.uri, None)