summaryrefslogtreecommitdiff
path: root/openerp/sql_db.py
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2013-02-16 02:18:31 +0100
committerOlivier Dony <odo@openerp.com>2013-02-16 02:18:31 +0100
commitbbb4f105dc480a814a4908afd97234a1c58acd13 (patch)
tree82177619fcb13224e280393978d88e1fad2cbe9f /openerp/sql_db.py
parent547372ef9461a12d8c552d3a8e6c69a24392d935 (diff)
[FIX] sql_db: immediately remove the connections from the pool when detected to be dead
lp bug: https://launchpad.net/bugs/905257 fixed bzr revid: odo@openerp.com-20130216011831-5ehi02j5nj6shh8n
Diffstat (limited to 'openerp/sql_db.py')
-rw-r--r--openerp/sql_db.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/openerp/sql_db.py b/openerp/sql_db.py
index 31540f7ae4c..9be6c61b013 100644
--- a/openerp/sql_db.py
+++ b/openerp/sql_db.py
@@ -412,15 +412,15 @@ class ConnectionPool(object):
for i, (cnx, used) in enumerate(self._connections):
if not used and dsn_are_equals(cnx.dsn, dsn):
+ self._connections.pop(i)
try:
cnx.reset()
except psycopg2.OperationalError:
- self._debug('Cannot reset connection at index %d: %r', i, cnx.dsn)
+ self._debug('Cannot reset connection at index %d: %r, removing it', i, cnx.dsn)
# psycopg2 2.4.4 and earlier do not allow closing a closed connection
if not cnx.closed:
cnx.close()
continue
- self._connections.pop(i)
self._connections.append((cnx, True))
self._debug('Existing connection found at index %d', i)