Skip to content

Commit

Permalink
Merge pull request #360 from ianco/master
Browse files Browse the repository at this point in the history
Set connections to autocommit to avoid transaction conflicts
  • Loading branch information
ianco authored Jul 5, 2024
2 parents 8a7c630 + f00e841 commit 3d4cb80
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions data-pipeline/bcreg/bcreg_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def __init__(self, cache=False):
self.conn.set_session(readonly=True)
#self.conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED)
self.conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_REPEATABLE_READ)
self.conn.autocommit = True

# Register the adapter
sqlite3.register_adapter(decimal.Decimal, adapt_decimal)
Expand All @@ -70,6 +71,7 @@ def __init__(self, cache=False):
self.sec_conn.set_session(readonly=True)
#self.sec_conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_READ_COMMITTED)
self.sec_conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_REPEATABLE_READ)
self.sec_conn.autocommit = True
except (Exception) as error:
LOGGER.error(error)
LOGGER.error(traceback.print_exc())
Expand Down

0 comments on commit 3d4cb80

Please sign in to comment.