mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-09-08 07:01:54 +00:00
Remove hacky error handling for inlineDeferreds. (#7950)
This commit is contained in:
parent
c4268e3da6
commit
d8a9cd8d3e
1
changelog.d/7950.misc
Normal file
1
changelog.d/7950.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Simplify error handling in federation handler.
|
@ -1887,9 +1887,6 @@ class FederationHandler(BaseHandler):
|
|||||||
origin, event, state=state, auth_events=auth_events, backfilled=backfilled
|
origin, event, state=state, auth_events=auth_events, backfilled=backfilled
|
||||||
)
|
)
|
||||||
|
|
||||||
# reraise does not allow inlineCallbacks to preserve the stacktrace, so we
|
|
||||||
# hack around with a try/finally instead.
|
|
||||||
success = False
|
|
||||||
try:
|
try:
|
||||||
if (
|
if (
|
||||||
not event.internal_metadata.is_outlier()
|
not event.internal_metadata.is_outlier()
|
||||||
@ -1903,12 +1900,11 @@ class FederationHandler(BaseHandler):
|
|||||||
await self.persist_events_and_notify(
|
await self.persist_events_and_notify(
|
||||||
[(event, context)], backfilled=backfilled
|
[(event, context)], backfilled=backfilled
|
||||||
)
|
)
|
||||||
success = True
|
except Exception:
|
||||||
finally:
|
|
||||||
if not success:
|
|
||||||
run_in_background(
|
run_in_background(
|
||||||
self.store.remove_push_actions_from_staging, event.event_id
|
self.store.remove_push_actions_from_staging, event.event_id
|
||||||
)
|
)
|
||||||
|
raise
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
@ -857,9 +857,6 @@ class EventCreationHandler(object):
|
|||||||
|
|
||||||
await self.action_generator.handle_push_actions_for_event(event, context)
|
await self.action_generator.handle_push_actions_for_event(event, context)
|
||||||
|
|
||||||
# reraise does not allow inlineCallbacks to preserve the stacktrace, so we
|
|
||||||
# hack around with a try/finally instead.
|
|
||||||
success = False
|
|
||||||
try:
|
try:
|
||||||
# If we're a worker we need to hit out to the master.
|
# If we're a worker we need to hit out to the master.
|
||||||
if not self._is_event_writer:
|
if not self._is_event_writer:
|
||||||
@ -875,22 +872,20 @@ class EventCreationHandler(object):
|
|||||||
)
|
)
|
||||||
stream_id = result["stream_id"]
|
stream_id = result["stream_id"]
|
||||||
event.internal_metadata.stream_ordering = stream_id
|
event.internal_metadata.stream_ordering = stream_id
|
||||||
success = True
|
|
||||||
return stream_id
|
return stream_id
|
||||||
|
|
||||||
stream_id = await self.persist_and_notify_client_event(
|
stream_id = await self.persist_and_notify_client_event(
|
||||||
requester, event, context, ratelimit=ratelimit, extra_users=extra_users
|
requester, event, context, ratelimit=ratelimit, extra_users=extra_users
|
||||||
)
|
)
|
||||||
|
|
||||||
success = True
|
|
||||||
return stream_id
|
return stream_id
|
||||||
finally:
|
except Exception:
|
||||||
if not success:
|
|
||||||
# Ensure that we actually remove the entries in the push actions
|
# Ensure that we actually remove the entries in the push actions
|
||||||
# staging area, if we calculated them.
|
# staging area, if we calculated them.
|
||||||
run_in_background(
|
run_in_background(
|
||||||
self.store.remove_push_actions_from_staging, event.event_id
|
self.store.remove_push_actions_from_staging, event.event_id
|
||||||
)
|
)
|
||||||
|
raise
|
||||||
|
|
||||||
async def _validate_canonical_alias(
|
async def _validate_canonical_alias(
|
||||||
self, directory_handler, room_alias_str: str, expected_room_id: str
|
self, directory_handler, room_alias_str: str, expected_room_id: str
|
||||||
|
Loading…
Reference in New Issue
Block a user