-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reintroduce #17291. #17338
Reintroduce #17291. #17338
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -303,13 +303,13 @@ def calculate_chain_cover_index_for_events_txn( | |
retcols=("room_id", "has_auth_chain_index"), | ||
allow_none=True, | ||
) | ||
if row is None: | ||
if row is None or row[1] is False: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also a bug, though I don't think caused a problem in practice. |
||
return {} | ||
|
||
# Filter out already persisted events. | ||
# Filter out events that we've already calculated. | ||
rows = self.db_pool.simple_select_many_txn( | ||
txn, | ||
table="events", | ||
table="event_auth_chains", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It makes more sense to check if we have calculated the chain links rather than if we've persisted the event. |
||
column="event_id", | ||
iterable=[e.event_id for e in state_events], | ||
keyvalues={}, | ||
|
@@ -319,7 +319,7 @@ def calculate_chain_cover_index_for_events_txn( | |
state_events = [ | ||
event | ||
for event in state_events | ||
if event.event_id in already_persisted_events | ||
if event.event_id not in already_persisted_events | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The missing |
||
] | ||
|
||
if not state_events: | ||
|
@@ -600,6 +600,9 @@ def _persist_event_auth_chain_txn( | |
events: List[EventBase], | ||
new_event_links: Dict[str, NewEventChainLinks], | ||
) -> None: | ||
if new_event_links: | ||
self._persist_chain_cover_index(txn, self.db_pool, new_event_links) | ||
|
||
# We only care about state events, so this if there are no state events. | ||
if not any(e.is_state() for e in events): | ||
return | ||
|
@@ -622,9 +625,6 @@ def _persist_event_auth_chain_txn( | |
], | ||
) | ||
|
||
if new_event_links: | ||
self._persist_chain_cover_index(txn, self.db_pool, new_event_links) | ||
|
||
@classmethod | ||
def _add_chain_cover_index( | ||
cls, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really shouldn't be seeing these anymore I don't think, except while old servers are upgrading (with the background update running)