File tree Expand file tree Collapse file tree
synapse/storage/databases/main Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -133,17 +133,14 @@ def _should_skip_autosubscription_after_unsubscription(
133133 # For normal rooms, these two orderings should be positive, because
134134 # they don't refer to a specific event but rather the maximum at the
135135 # time of unsubscription.
136+ #
136137 # However, for rooms that have never been joined and that are being peeked at,
137138 # we might not have a single non-backfilled event and therefore the stream
138- # ordering might be negative.
139- # In this case, we clamp it at zero and ensure we fall back to
140- # using topological ordering.
141- unsubscribed_at = attr .evolve (
142- unsubscribed_at , stream = max (0 , unsubscribed_at .stream )
143- )
139+ # ordering might be negative, so we don't assert this case.
144140 assert unsubscribed_at .topological > 0
145141
146- if unsubscribed_at .stream >= autosub .stream > 0 :
142+ unsubscribed_at_backfilled = unsubscribed_at .stream < 0
143+ if unsubscribed_at_backfilled and unsubscribed_at .stream >= autosub .stream > 0 :
147144 # non-backfilled events: the unsubscription is later according to
148145 # the stream
149146 return True
You can’t perform that action at this time.
0 commit comments