From 2277d974581225574cc139b4c14bc9e18182512a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Fri, 10 Feb 2023 19:57:41 +0100 Subject: [PATCH] session_db: improve cursor release --- session_db/pg_session_store.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/session_db/pg_session_store.py b/session_db/pg_session_store.py index 1a6e3a2d4..849e431de 100644 --- a/session_db/pg_session_store.py +++ b/session_db/pg_session_store.py @@ -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