summary refs log tree commit diff
path: root/synapse/storage/roommember.py
diff options
context:
space:
mode:
authorMark Haines <mark.haines@matrix.org>2014-08-26 14:31:48 +0100
committerMark Haines <mark.haines@matrix.org>2014-08-26 14:36:03 +0100
commit4b2ad549d5a1dcf5c05f890c0383626d6c042fd0 (patch)
tree8aec582555ff9c4551cfd50c3808ab6f313ac4bf /synapse/storage/roommember.py
parentTake a snapshot of the state of the room before performing updates (diff)
downloadsynapse-4b2ad549d5a1dcf5c05f890c0383626d6c042fd0.tar.xz
Move the event storage into a single transaction
Diffstat (limited to 'synapse/storage/roommember.py')
-rw-r--r--synapse/storage/roommember.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/storage/roommember.py b/synapse/storage/roommember.py
index 89c87290cf..1df043cd36 100644
--- a/synapse/storage/roommember.py
+++ b/synapse/storage/roommember.py
@@ -31,13 +31,13 @@ logger = logging.getLogger(__name__)
 
 class RoomMemberStore(SQLBaseStore):
 
-    @defer.inlineCallbacks
-    def _store_room_member(self, event):
+    def _store_room_member_txn(self, txn, event):
         """Store a room member in the database.
         """
         domain = self.hs.parse_userid(event.target_user_id).domain
 
-        yield self._simple_insert(
+        self._simple_insert_txn(
+            txn,
             "room_memberships",
             {
                 "event_id": event.event_id,
@@ -54,13 +54,13 @@ class RoomMemberStore(SQLBaseStore):
                 "INSERT OR IGNORE INTO room_hosts (room_id, host) "
                 "VALUES (?, ?)"
             )
-            yield self._execute(None, sql, event.room_id, domain)
+            txn.execute(sql, event.room_id, domain)
         else:
             sql = (
                 "DELETE FROM room_hosts WHERE room_id = ? AND host = ?"
             )
 
-            yield self._execute(None, sql, event.room_id, domain)
+            txn.execute(sql, event.room_id, domain)
 
     @defer.inlineCallbacks
     def get_room_member(self, user_id, room_id):