Merge lp:~openerp-dev/openobject-server/7.0-rstcnx-chs into lp:openobject-server/7.0
Status: | Merged |
---|---|
Approved by: | Christophe Simonis (OpenERP) |
Approved revision: | 4842 |
Merge reported by: | Christophe Simonis (OpenERP) |
Merged at revision: | not available |
Proposed branch: | lp:~openerp-dev/openobject-server/7.0-rstcnx-chs |
Merge into: | lp:openobject-server/7.0 |
Diff against target: |
32 lines (+8/-8) 1 file modified
openerp/sql_db.py (+8/-8) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-server/7.0-rstcnx-chs |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+148848@code.launchpad.net |
This proposal supersedes a proposal from 2013-02-14.
Description of the change
Resubmitting the branch after updating the code for better performance: we don't want to force a connection reset on all connections that are present in the pool every time a new cursor is being opened. We only want to do that for the actual unused connection we are planning to pick from the pool - as a last minute validation check. If the check fails we can immediately remove the connection from the pool and try the next one.
BTW doing the reset() call looks like a good thing when preparing a connection for a new cursor: it will cleanup any possible leftover changes to the session done by previous cursors. But it must not be done on connections that are in use, of course.
LGTM, but after testing with older psycopg2 versions I had to add a check before calling cnx.close(), as close() used to raise an Exception if the connection was already marked as closed (that is, before psycopg2 2.4.5)
Note that reset() was introduced in psycopg2 2.0.12, so we might want to make the requirement explicit in setup.py. For 7.0 we actually require the `current version from debian stable as of the release date`, and this has been 2.2.1 since 2010.
See also the rationale for this patch in the comments on https:/ /code.launchpad .net/~florent. x/openobject- server/ trunk-bug- 905257- fix-reconnect/ +merge/ 132149