Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Handle the case of get_missing_events failing #5042

Merged
merged 4 commits into from
Jun 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/5042.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix bug processing incoming events over federation if call to `/get_missing_events` fails.
28 changes: 19 additions & 9 deletions synapse/handlers/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,25 @@ def _get_missing_events_for_pdu(self, origin, pdu, prevs, min_depth):
#
# All that said: Let's try increasing the timout to 60s and see what happens.

missing_events = yield self.federation_client.get_missing_events(
origin,
room_id,
earliest_events_ids=list(latest),
latest_events=[pdu],
limit=10,
min_depth=min_depth,
timeout=60000,
)
try:
missing_events = yield self.federation_client.get_missing_events(
origin,
room_id,
earliest_events_ids=list(latest),
latest_events=[pdu],
limit=10,
min_depth=min_depth,
timeout=60000,
)
except RequestSendFailed as e:
# We failed to get the missing events, but since we need to handle
# the case of `get_missing_events` not returning the necessary
# events anyway, it is safe to simply log the error and continue.
logger.warn(
"[%s %s]: Failed to get prev_events: %s",
room_id, event_id, e,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs more params

)
return

logger.info(
"[%s %s]: Got %d prev_events: %s",
Expand Down