Merge pull request #3967 from matrix-org/rav/federation_handler_cleanups

Clarifications in FederationHandler
This commit is contained in:
Richard van der Hoff 2018-09-27 15:06:59 +01:00 committed by GitHub
commit e1e3e77bfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

1
changelog.d/3967.misc Normal file
View File

@ -0,0 +1 @@
Clarifications in FederationHandler

View File

@ -209,8 +209,6 @@ class FederationClient(FederationBase):
Will attempt to get the PDU from each destination in the list until Will attempt to get the PDU from each destination in the list until
one succeeds. one succeeds.
This will persist the PDU locally upon receipt.
Args: Args:
destinations (list): Which home servers to query destinations (list): Which home servers to query
event_id (str): event to fetch event_id (str): event to fetch

View File

@ -341,14 +341,22 @@ class FederationHandler(BaseHandler):
) )
with logcontext.nested_logging_context(p): with logcontext.nested_logging_context(p):
state, got_auth_chain = ( # note that if any of the missing prevs share missing state or
# auth events, the requests to fetch those events are deduped
# by the get_pdu_cache in federation_client.
remote_state, got_auth_chain = (
yield self.federation_client.get_state_for_room( yield self.federation_client.get_state_for_room(
origin, room_id, p, origin, room_id, p,
) )
) )
# XXX hrm I'm not convinced that duplicate events will compare
# for equality, so I'm not sure this does what the author
# hoped.
auth_chains.update(got_auth_chain) auth_chains.update(got_auth_chain)
state_group = { state_group = {
(x.type, x.state_key): x.event_id for x in state (x.type, x.state_key): x.event_id for x in remote_state
} }
state_groups.append(state_group) state_groups.append(state_group)