summary refs log tree commit diff
path: root/synapse/storage/__init__.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/__init__.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/__init__.py')
-rw-r--r--synapse/storage/__init__.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/storage/__init__.py b/synapse/storage/__init__.py
index 2773b2cb13..0cc14fb692 100644
--- a/synapse/storage/__init__.py
+++ b/synapse/storage/__init__.py
@@ -104,6 +104,8 @@ class DataStore(RoomMemberStore, RoomStore,
 
         self.client_ip_last_seen.prefill(*key + (now,))
 
+        # It's safe not to lock here: a) no unique constraint,
+        # b) LAST_SEEN_GRANULARITY makes concurrent updates incredibly unlikely
         yield self._simple_upsert(
             "user_ips",
             keyvalues={
@@ -117,6 +119,7 @@ class DataStore(RoomMemberStore, RoomStore,
                 "last_seen": now,
             },
             desc="insert_client_ip",
+            lock=False,
         )
 
     def get_user_ip_and_agents(self, user):