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

Commit

Permalink
Disallow outliers from being used with the gap checks
Browse files Browse the repository at this point in the history
  • Loading branch information
MadLittleMods committed Oct 17, 2022
1 parent 2c63cdc commit 788140a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions synapse/storage/databases/main/events_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1976,12 +1976,17 @@ async def is_event_next_to_backward_gap(self, event: EventBase) -> bool:
Args:
room_id: room where the event lives
event_id: event to check
event_id: event to check (can't be an `outlier`)
Returns:
Boolean indicating whether it's an extremity
"""

assert not event.internal_metadata.is_outlier(), (
"is_event_next_to_backward_gap(...) can not be used with `outlier` events. "
"This function relies on `event_backward_extremities` which won't be filled in for `outliers."
)

def is_event_next_to_backward_gap_txn(txn: LoggingTransaction) -> bool:
# If the event in question has any of its prev_events listed as a
# backward extremity, it's next to a gap.
Expand Down Expand Up @@ -2031,12 +2036,17 @@ async def is_event_next_to_forward_gap(self, event: EventBase) -> bool:
Args:
room_id: room where the event lives
event_id: event to check
event_id: event to check (can't be an `outlier`)
Returns:
Boolean indicating whether it's an extremity
"""

assert not event.internal_metadata.is_outlier(), (
"is_event_next_to_forward_gap(...) can not be used with `outlier` events. "
"This function relies on `event_edges` and `event_forward_extremities` which won't be filled in for `outliers."
)

def is_event_next_to_gap_txn(txn: LoggingTransaction) -> bool:
# If the event in question is a forward extremity, we will just
# consider any potential forward gap as not a gap since it's one of
Expand Down

0 comments on commit 788140a

Please sign in to comment.