session_db: improve cursor release

pull/2550/head
Stéphane Bidoul 2023-02-10 19:57:41 +01:00
parent b13029ab08
commit 2277d97458
1 changed files with 6 additions and 6 deletions

View File

@ -69,13 +69,13 @@ class PGSessionStore(sessions.SessionStore):
@with_lock
def _open_connection(self):
try:
# return cursor to the pool
if self._cr is not None:
# return cursor to the pool
if self._cr is not None:
try:
self._cr.close()
self._cr = None
except Exception: # pylint: disable=except-pass
pass
except Exception: # pylint: disable=except-pass
pass
self._cr = None
cnx = odoo.sql_db.db_connect(self._uri, allow_uri=True)
self._cr = cnx.cursor()
self._cr._cnx.autocommit = True