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
1=== modified file 'openerp/sql_db.py'
2--- openerp/sql_db.py 2013-02-15 16:01:58 +0000
3+++ openerp/sql_db.py 2013-02-16 11:11:22 +0000
4@@ -388,14 +388,6 @@
5
6 # free dead and leaked connections
7 for i, (cnx, _) in tools.reverse_enumerate(self._connections):
8- try:
9- cnx.reset()
10- except psycopg2.OperationalError:
11- self._debug('Cannot reset connection at index %d: %r', i, cnx.dsn)
12- # psycopg2 2.4.4 and earlier do not allow closing a closed connection
13- if not cnx.closed:
14- cnx.close()
15-
16 if cnx.closed:
17 self._connections.pop(i)
18 self._debug('Removing closed connection at index %d: %r', i, cnx.dsn)
19@@ -409,6 +401,14 @@
20 for i, (cnx, used) in enumerate(self._connections):
21 if not used and dsn_are_equals(cnx.dsn, dsn):
22 self._connections.pop(i)
23+ try:
24+ cnx.reset()
25+ except psycopg2.OperationalError:
26+ self._debug('Cannot reset connection at index %d: %r, removing it', i, cnx.dsn)
27+ # psycopg2 2.4.4 and earlier do not allow closing a closed connection
28+ if not cnx.closed:
29+ cnx.close()
30+ continue
31 self._connections.append((cnx, True))
32 self._debug('Existing connection found at index %d', i)
33

Subscribers

People subscribed via source and target branches