Skip to content

Commit

Permalink
catch error when there are concurrent attempts to update the postgres…
Browse files Browse the repository at this point in the history
… schema
  • Loading branch information
leondutoit committed Aug 24, 2020
1 parent c9eb0d4 commit 2a37c11
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tsdfileapi/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,12 @@ def __init__(self, pool, verbose=False, schema=None, requestor=None):
self.requestor = requestor

def initialise(self):
with postgres_session(self.pool) as session:
for stmt in self.generator_class.db_init_sql:
session.execute(stmt)
try:
with postgres_session(self.pool) as session:
for stmt in self.generator_class.db_init_sql:
session.execute(stmt)
except psycopg2.InternalError as e:
pass # throws a tuple concurrently updated when restarting many processes
return True

def tables_list(self):
Expand Down

0 comments on commit 2a37c11

Please sign in to comment.