summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-07 12:05:36 +0100
committerErik Johnston <erik@matrix.org>2015-04-07 12:05:36 +0100
commit304111afd0fdda6a0c58d81238a1bbfa7f318208 (patch)
treebfa6ce488926c27a6820f8c6a7e78743faa2b5e4 /synapse/storage/events.py
parentExplicitly name the __main__ module logger (diff)
downloadsynapse-304111afd0fdda6a0c58d81238a1bbfa7f318208.tar.xz
Don't use AUTOINCREMENT, use an in memory version
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r--synapse/storage/events.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index 69f598967e..514feebcbf 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -96,12 +96,16 @@ class EventsStore(SQLBaseStore):
         # Remove the any existing cache entries for the event_id
         self._get_event_cache.pop(event.event_id)
 
+        if stream_ordering is None:
+            stream_ordering = self._stream_id_gen.get_next_txn(txn)
+
         # We purposefully do this first since if we include a `current_state`
         # key, we *want* to update the `current_state_events` table
         if current_state:
-            txn.execute(
-                "DELETE FROM current_state_events WHERE room_id = ?",
-                (event.room_id,)
+            self._simple_delete_txn(
+                txn,
+                table="current_state_events",
+                keyvalues={"room_id": event.room_id},
             )
 
             for s in current_state:
@@ -240,9 +244,6 @@ class EventsStore(SQLBaseStore):
             "depth": event.depth,
         }
 
-        if stream_ordering is None:
-            stream_ordering = self.get_next_stream_id()
-
         unrec = {
             k: v
             for k, v in event.get_dict().items()