This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix federation backfill bugs #3261
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -763,7 +763,7 @@ def get_domains_from_state(state): | |
""" | ||
joined_users = [ | ||
(state_key, int(event.depth)) | ||
for (e_type, state_key), event in state.items() | ||
for (e_type, state_key), event in state.iteritems() | ||
if e_type == EventTypes.Member | ||
and event.membership == Membership.JOIN | ||
] | ||
|
@@ -780,7 +780,7 @@ def get_domains_from_state(state): | |
except Exception: | ||
pass | ||
|
||
return sorted(joined_domains.items(), key=lambda d: d[1]) | ||
return sorted(joined_domains.iteritems(), key=lambda d: d[1]) | ||
|
||
curr_domains = get_domains_from_state(curr_state) | ||
|
||
|
@@ -797,7 +797,7 @@ def try_backfill(domains): | |
yield self.backfill( | ||
dom, room_id, | ||
limit=100, | ||
extremities=[e for e in extremities.keys()] | ||
extremities=extremities, | ||
) | ||
# If this succeeded then we probably already have the | ||
# appropriate stuff. | ||
|
@@ -843,7 +843,7 @@ def try_backfill(domains): | |
tried_domains = set(likely_domains) | ||
tried_domains.add(self.server_name) | ||
|
||
event_ids = list(extremities.keys()) | ||
event_ids = list(extremities.iterkeys()) | ||
|
||
logger.debug("calling resolve_state_groups in _maybe_backfill") | ||
resolve = logcontext.preserve_fn( | ||
|
@@ -859,15 +859,15 @@ def try_backfill(domains): | |
states = dict(zip(event_ids, [s.state for s in states])) | ||
|
||
state_map = yield self.store.get_events( | ||
[e_id for ids in states.values() for e_id in ids.itervalues()], | ||
[e_id for ids in states.itervalues() for e_id in ids.itervalues()], | ||
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. why is this changing from assuming you've just unpicked what 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. Have added a comment and typing info |
||
get_prev_content=False | ||
) | ||
states = { | ||
key: { | ||
k: state_map[e_id] | ||
for k, e_id in state_dict.items() | ||
for k, e_id in state_dict.iteritems() | ||
if e_id in state_map | ||
} for key, state_dict in states.items() | ||
} for key, state_dict in states.iteritems() | ||
} | ||
|
||
for e_id, _ in sorted_extremeties_tuple: | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
isn't this the same as
list(extremities)
? Happy for this to be explicit but it's the opposite to what you've done at line 800