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

Commit

Permalink
Exclude soft-failed events from fwd-extremity candidates.
Browse files Browse the repository at this point in the history
When considering the candidates to be forward-extremities, we must exclude soft
failures.

Hopefully fixes #5090.
  • Loading branch information
richvdh committed May 6, 2019
1 parent 3fdff14 commit b6709b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/5146.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Exclude soft-failed events from forward-extremity candidates: fixes "No forward extremities left!" error.
9 changes: 7 additions & 2 deletions synapse/storage/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,11 @@ def _get_events_which_are_prevs(self, event_ids):

def _get_events(txn, batch):
sql = """
SELECT prev_event_id
SELECT prev_event_id, internal_metadata
FROM event_edges
INNER JOIN events USING (event_id)
LEFT JOIN rejections USING (event_id)
LEFT JOIN event_json USING (event_id)
WHERE
prev_event_id IN (%s)
AND NOT events.outlier
Expand All @@ -588,7 +589,11 @@ def _get_events(txn, batch):
)

txn.execute(sql, batch)
results.extend(r[0] for r in txn)
results.extend(
r[0]
for r in txn
if not json.loads(r[1]).get("soft_failed")
)

for chunk in batch_iter(event_ids, 100):
yield self.runInteraction("_get_events_which_are_prevs", _get_events, chunk)
Expand Down

0 comments on commit b6709b0

Please sign in to comment.