diff --git a/session_db/pg_session_store.py b/session_db/pg_session_store.py index 189be9658..1a6e3a2d4 100644 --- a/session_db/pg_session_store.py +++ b/session_db/pg_session_store.py @@ -69,7 +69,6 @@ class PGSessionStore(sessions.SessionStore): @with_lock def _open_connection(self): - cnx = odoo.sql_db.db_connect(self._uri, allow_uri=True) try: # return cursor to the pool if self._cr is not None: @@ -77,6 +76,7 @@ class PGSessionStore(sessions.SessionStore): self._cr = None except Exception: # pylint: disable=except-pass pass + cnx = odoo.sql_db.db_connect(self._uri, allow_uri=True) self._cr = cnx.cursor() self._cr._cnx.autocommit = True