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

Commit

Permalink
Merge pull request #5042 from matrix-org/erikj/fix_get_missing_events…
Browse files Browse the repository at this point in the history
…_error

Handle the case of `get_missing_events` failing
  • Loading branch information
erikjohnston authored Jun 19, 2019
2 parents e0be8d7 + 2b20d0f commit 7dcf984
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
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,
)
return

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

0 comments on commit 7dcf984

Please sign in to comment.