mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-24 23:49:22 -05:00
Ensure that we delete staging push actions on errors
This commit is contained in:
parent
4810f7effd
commit
b96278d6fe
@ -683,9 +683,15 @@ class EventCreationHandler(object):
|
|||||||
event, context
|
event, context
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
(event_stream_id, max_stream_id) = yield self.store.persist_event(
|
(event_stream_id, max_stream_id) = yield self.store.persist_event(
|
||||||
event, context=context
|
event, context=context
|
||||||
)
|
)
|
||||||
|
except: # noqa: E722, as we reraise the exception this is fine.
|
||||||
|
# Ensure that we actually remove the entries in the push actions
|
||||||
|
# staging area
|
||||||
|
preserve_fn(self.store.remove_push_actions_from_staging)(event.event_id)
|
||||||
|
raise
|
||||||
|
|
||||||
# this intentionally does not yield: we don't care about the result
|
# this intentionally does not yield: we don't care about the result
|
||||||
# and don't need to wait for it.
|
# and don't need to wait for it.
|
||||||
|
@ -782,6 +782,22 @@ class EventPushActionsStore(SQLBaseStore):
|
|||||||
desc="add_push_actions_to_staging",
|
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):
|
def _action_has_highlight(actions):
|
||||||
for action in actions:
|
for action in actions:
|
||||||
|
Loading…
Reference in New Issue
Block a user