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

@ -466,6 +466,9 @@ class SQLBaseStore(object):
)
def _simple_upsert_txn(self, txn, table, keyvalues, values, insertion_values={}):
# We need to lock the table :(
self.database_engine.lock_table(txn, table)
# Try to update
sql = "UPDATE %s SET %s WHERE %s" % (
table,