Shuffle operations so that locking upsert happens last in the txn. This ensures the lock is held for the least amount of time possible.

This commit is contained in:
Erik Johnston 2015-04-27 13:22:30 +01:00
parent e4c4664d73
commit 2732be83d9
5 changed files with 59 additions and 59 deletions

View file

@ -42,3 +42,6 @@ class PostgresEngine(object):
def is_connection_closed(self, conn):
return bool(conn)
def lock_table(self, txn, table):
txn.execute("LOCK TABLE %s in EXCLUSIVE MODE" % (table,))