summary refs log tree commit diff
path: root/synapse/storage/event_push_actions.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-02-15 15:37:40 +0000
committerErik Johnston <erik@matrix.org>2018-02-15 15:47:06 +0000
commitb96278d6fe499e47133d2d2e82b9d3a0074d7005 (patch)
tree8296465c2af1f3e06734427c793772fc623dfae3 /synapse/storage/event_push_actions.py
parentRemove context.push_actions (diff)
downloadsynapse-b96278d6fe499e47133d2d2e82b9d3a0074d7005.tar.xz
Ensure that we delete staging push actions on errors
Diffstat (limited to 'synapse/storage/event_push_actions.py')
-rw-r--r--synapse/storage/event_push_actions.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/synapse/storage/event_push_actions.py b/synapse/storage/event_push_actions.py
index 34ff9be731..28226455bf 100644
--- a/synapse/storage/event_push_actions.py
+++ b/synapse/storage/event_push_actions.py
@@ -782,6 +782,22 @@ class EventPushActionsStore(SQLBaseStore):
             desc="add_push_actions_to_staging",
         )
 
+    def remove_push_actions_from_staging(self, event_id):
+        """Called if we failed to persist the event to ensure that stale push
+        actions don't build up in the DB
+
+        Args:
+            event_id (str)
+        """
+
+        return self._simple_delete(
+            table="event_push_actions_staging",
+            keyvalues={
+                "event_id": event_id,
+            },
+            desc="remove_push_actions_from_staging",
+        )
+
 
 def _action_has_highlight(actions):
     for action in actions: