session_db: improve cursor release
parent
b13029ab08
commit
2277d97458
|
@ -69,13 +69,13 @@ class PGSessionStore(sessions.SessionStore):
|
||||||
|
|
||||||
@with_lock
|
@with_lock
|
||||||
def _open_connection(self):
|
def _open_connection(self):
|
||||||
try:
|
|
||||||
# return cursor to the pool
|
# return cursor to the pool
|
||||||
if self._cr is not None:
|
if self._cr is not None:
|
||||||
|
try:
|
||||||
self._cr.close()
|
self._cr.close()
|
||||||
self._cr = None
|
|
||||||
except Exception: # pylint: disable=except-pass
|
except Exception: # pylint: disable=except-pass
|
||||||
pass
|
pass
|
||||||
|
self._cr = None
|
||||||
cnx = odoo.sql_db.db_connect(self._uri, allow_uri=True)
|
cnx = odoo.sql_db.db_connect(self._uri, allow_uri=True)
|
||||||
self._cr = cnx.cursor()
|
self._cr = cnx.cursor()
|
||||||
self._cr._cnx.autocommit = True
|
self._cr._cnx.autocommit = True
|
||||||
|
|
Loading…
Reference in New Issue