Merge lp:~stefan-opener/therp-backports/7.0-rstcnx-chs into lp:therp-backports/server-6.1

Proposed by Stefan Rijnhart (Opener)
Status: Merged
Merged at revision: 4298
Proposed branch: lp:~stefan-opener/therp-backports/7.0-rstcnx-chs
Merge into: lp:therp-backports/server-6.1
Diff against target: 32 lines (+8/-8)
1 file modified
openerp/sql_db.py (+8/-8)
To merge this branch: bzr merge lp:~stefan-opener/therp-backports/7.0-rstcnx-chs
Reviewer Review Type Date Requested Status
Therp Pending
Review via email: mp+148867@code.launchpad.net

Commit message

[RFR] improved previous fix for lp:905257 in rev. 4298

Description of the change

Previous fix for lp:905257 has already been refactored+merged again. See https://code.launchpad.net/~openerp-dev/openobject-server/7.0-rstcnx-chs/+merge/148848

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'openerp/sql_db.py'
--- openerp/sql_db.py 2013-02-15 16:01:58 +0000
+++ openerp/sql_db.py 2013-02-16 11:11:22 +0000
@@ -388,14 +388,6 @@
388388
389 # free dead and leaked connections389 # free dead and leaked connections
390 for i, (cnx, _) in tools.reverse_enumerate(self._connections):390 for i, (cnx, _) in tools.reverse_enumerate(self._connections):
391 try:
392 cnx.reset()
393 except psycopg2.OperationalError:
394 self._debug('Cannot reset connection at index %d: %r', i, cnx.dsn)
395 # psycopg2 2.4.4 and earlier do not allow closing a closed connection
396 if not cnx.closed:
397 cnx.close()
398
399 if cnx.closed:391 if cnx.closed:
400 self._connections.pop(i)392 self._connections.pop(i)
401 self._debug('Removing closed connection at index %d: %r', i, cnx.dsn)393 self._debug('Removing closed connection at index %d: %r', i, cnx.dsn)
@@ -409,6 +401,14 @@
409 for i, (cnx, used) in enumerate(self._connections):401 for i, (cnx, used) in enumerate(self._connections):
410 if not used and dsn_are_equals(cnx.dsn, dsn):402 if not used and dsn_are_equals(cnx.dsn, dsn):
411 self._connections.pop(i)403 self._connections.pop(i)
404 try:
405 cnx.reset()
406 except psycopg2.OperationalError:
407 self._debug('Cannot reset connection at index %d: %r, removing it', i, cnx.dsn)
408 # psycopg2 2.4.4 and earlier do not allow closing a closed connection
409 if not cnx.closed:
410 cnx.close()
411 continue
412 self._connections.append((cnx, True))412 self._connections.append((cnx, True))
413 self._debug('Existing connection found at index %d', i)413 self._debug('Existing connection found at index %d', i)
414414

Subscribers

People subscribed via source and target branches