summary refs log tree commit diff
path: root/synapse/storage/events.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-02-20 12:33:04 +0000
committerErik Johnston <erik@matrix.org>2018-02-20 12:34:31 +0000
commit24087bffa932660cf4482b465b759f7161465f8a (patch)
tree719247f4542f148fccb53319140bfb35f5eb9158 /synapse/storage/events.py
parentRefactor _set_push_actions_for_event_and_users_txn to use events_and_contexts (diff)
downloadsynapse-24087bffa932660cf4482b465b759f7161465f8a.tar.xz
Ensure all push actions are deleted from staging
Diffstat (limited to 'synapse/storage/events.py')
-rw-r--r--synapse/storage/events.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/synapse/storage/events.py b/synapse/storage/events.py
index c8b8abc2e7..7f8561a0c4 100644
--- a/synapse/storage/events.py
+++ b/synapse/storage/events.py
@@ -693,6 +693,8 @@ class EventsStore(SQLBaseStore):
                 list of the event ids which are the forward extremities.
 
         """
+        all_events_and_contexts = events_and_contexts
+
         max_stream_order = events_and_contexts[-1][0].internal_metadata.stream_ordering
 
         self._update_current_state_txn(txn, state_delta_for_room, max_stream_order)
@@ -755,6 +757,7 @@ class EventsStore(SQLBaseStore):
         self._update_metadata_tables_txn(
             txn,
             events_and_contexts=events_and_contexts,
+            all_events_and_contexts=all_events_and_contexts,
             backfilled=backfilled,
         )
 
@@ -1152,13 +1155,18 @@ class EventsStore(SQLBaseStore):
             ec for ec in events_and_contexts if ec[0] not in to_remove
         ]
 
-    def _update_metadata_tables_txn(self, txn, events_and_contexts, backfilled):
+    def _update_metadata_tables_txn(self, txn, events_and_contexts,
+                                    all_events_and_contexts, backfilled):
         """Update all the miscellaneous tables for new events
 
         Args:
             txn (twisted.enterprise.adbapi.Connection): db connection
             events_and_contexts (list[(EventBase, EventContext)]): events
                 we are persisting
+            all_events_and_contexts (list[(EventBase, EventContext)]): all
+                events that we were going to persist. This includes events
+                we've already persisted, etc, that wouldn't appear in
+                events_and_context.
             backfilled (bool): True if the events were backfilled
         """
 
@@ -1166,6 +1174,7 @@ class EventsStore(SQLBaseStore):
         self._set_push_actions_for_event_and_users_txn(
             txn,
             events_and_contexts=events_and_contexts,
+            all_events_and_contexts=all_events_and_contexts,
         )
 
         if not events_and_contexts: