From 0240416a135aeff751185d7f3690e1097bd12c05 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 19 Feb 2013 11:26:10 +0100 Subject: [PATCH] [REVERT] sql_db: undo eager removal of connections from pool; could skip half the connections and is not strictly required Credit to Florent Xicluna for spotting it! lp bug: https://launchpad.net/bugs/905257 fixed bzr revid: odo@openerp.com-20130219102610-ll69qaf3zxem1pxf --- openerp/sql_db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/sql_db.py b/openerp/sql_db.py index 9be6c61b013..31540f7ae4c 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, removing it', i, cnx.dsn) + self._debug('Cannot reset connection at index %d: %r', 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)