summary refs log tree commit diff
path: root/synapse/storage/_base.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-05-01 10:46:48 +0100
committerErik Johnston <erik@matrix.org>2015-05-01 10:46:48 +0100
commit657298cebd312d9b636b822a8c116f17b001b5f6 (patch)
tree20c98976bdc3c6d5548db0a512197f57c4234762 /synapse/storage/_base.py
parentFix bug where we reconnected to the database on every query. (diff)
downloadsynapse-657298cebd312d9b636b822a8c116f17b001b5f6.tar.xz
Don't lock user_ips table for upsert.
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r--synapse/storage/_base.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py

index 1945e0d174..c328b5274c 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py
@@ -452,7 +452,7 @@ class SQLBaseStore(object): txn.execute(sql, values.values()) def _simple_upsert(self, table, keyvalues, values, - insertion_values={}, desc="_simple_upsert"): + insertion_values={}, desc="_simple_upsert", lock=True): """ Args: table (str): The table to upsert into @@ -464,11 +464,14 @@ class SQLBaseStore(object): return self.runInteraction( desc, self._simple_upsert_txn, table, keyvalues, values, insertion_values, + lock ) - def _simple_upsert_txn(self, txn, table, keyvalues, values, insertion_values={}): - # We need to lock the table :( - self.database_engine.lock_table(txn, table) + def _simple_upsert_txn(self, txn, table, keyvalues, values, insertion_values={}, + lock=True): + # We need to lock the table :(, unless we're *really* careful + if lock: + self.database_engine.lock_table(txn, table) # Try to update sql = "UPDATE %s SET %s WHERE %s" % (