summary refs log tree commit diff
path: root/synapse/storage/client_ips.py
diff options
context:
space:
mode:
authorAmber Brown <hawkowl@atleastfornow.net>2019-01-24 21:31:54 +1100
committerGitHub <noreply@github.com>2019-01-24 21:31:54 +1100
commit58f6c4818337364dd9c6bf01062e7b0dadcb8a25 (patch)
tree505122b391e64d171dea79efb697ba1245d45010 /synapse/storage/client_ips.py
parentDon't send IP addresses as SNI (#4452) (diff)
downloadsynapse-58f6c4818337364dd9c6bf01062e7b0dadcb8a25.tar.xz
Use native UPSERTs where possible (#4306)
Diffstat (limited to 'synapse/storage/client_ips.py')
-rw-r--r--synapse/storage/client_ips.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/synapse/storage/client_ips.py b/synapse/storage/client_ips.py
index b228a20ac2..091d7116c5 100644
--- a/synapse/storage/client_ips.py
+++ b/synapse/storage/client_ips.py
@@ -257,7 +257,10 @@ class ClientIpStore(background_updates.BackgroundUpdateStore):
         )
 
     def _update_client_ips_batch_txn(self, txn, to_update):
-        self.database_engine.lock_table(txn, "user_ips")
+        if "user_ips" in self._unsafe_to_upsert_tables or (
+            not self.database_engine.can_native_upsert
+        ):
+            self.database_engine.lock_table(txn, "user_ips")
 
         for entry in iteritems(to_update):
             (user_id, access_token, ip), (user_agent, device_id, last_seen) = entry