Skip to content

Commit

Permalink
Merge PR OCA#2531 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by sbidoul
  • Loading branch information
OCA-git-bot committed Jan 23, 2023
2 parents 3942996 + 018b664 commit d2b26a0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion session_db/pg_session_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def wrapper(self, *args, **kwargs):
tries += 1
try:
return func(self, *args, **kwargs)
except psycopg2.InterfaceError as e:
except (psycopg2.InterfaceError, psycopg2.OperationalError) as e:
_logger.info("Session in DB connection Retry %s/5" % tries)
if tries > 4:
raise e
Expand All @@ -49,6 +49,13 @@ def __del__(self):

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:
self._cr.close()
self._cr = None
except Exception: # pylint: disable=except-pass
pass
self._cr = cnx.cursor()
self._cr._cnx.autocommit = True

Expand Down

0 comments on commit d2b26a0

Please sign in to comment.