This commit is contained in:
Erik Johnston 2017-04-28 12:46:53 +01:00
parent 9b147cd730
commit 2347efc065

View File

@ -174,11 +174,9 @@ class FederationHandler(BaseHandler):
# Update the set of things we've seen after trying to # Update the set of things we've seen after trying to
# fetch the missing stuff # fetch the missing stuff
have_seen = yield self.store.have_events( have_seen = yield self.store.have_events(prevs)
[ev for ev, _ in pdu.prev_events]
)
seen = set(have_seen.keys()) seen = set(have_seen.iterkeys())
if prevs - seen: if prevs - seen:
logger.info( logger.info(
"Still missing %d prev events for %s: %r...", "Still missing %d prev events for %s: %r...",
@ -231,19 +229,15 @@ class FederationHandler(BaseHandler):
Args: Args:
origin (str): Origin of the pdu. Will be called to get the missing events origin (str): Origin of the pdu. Will be called to get the missing events
pdu: received pdu pdu: received pdu
prevs (str[]): List of event ids which we are missing prevs (set(str)): List of event ids which we are missing
min_depth (int): Minimum depth of events to return. min_depth (int): Minimum depth of events to return.
Returns:
Deferred<dict(str, str?)>: updated have_seen dictionary
""" """
# We recalculate seen, since it may have changed. # We recalculate seen, since it may have changed.
have_seen = yield self.store.have_events(prevs) have_seen = yield self.store.have_events(prevs)
seen = set(have_seen.keys()) seen = set(have_seen.keys())
if not prevs - seen: if not prevs - seen:
# nothing left to do return
defer.returnValue(have_seen)
latest = yield self.store.get_latest_event_ids_in_room( latest = yield self.store.get_latest_event_ids_in_room(
pdu.room_id pdu.room_id