mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-21 01:44:19 -05:00
Merge pull request #2170 from matrix-org/erikj/fed_hole_state
Don't fetch state for missing events that we fetched
This commit is contained in:
commit
0c27383dd7
@ -171,6 +171,16 @@ class FederationHandler(BaseHandler):
|
|||||||
yield self._get_missing_events_for_pdu(
|
yield self._get_missing_events_for_pdu(
|
||||||
origin, pdu, prevs, min_depth
|
origin, pdu, prevs, min_depth
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Update the set of things we've seen after trying to
|
||||||
|
# fetch the missing stuff
|
||||||
|
have_seen = yield self.store.have_events(prevs)
|
||||||
|
seen = set(have_seen.iterkeys())
|
||||||
|
|
||||||
|
if not prevs - seen:
|
||||||
|
logger.info(
|
||||||
|
"Found all missing prev events for %s", pdu.event_id
|
||||||
|
)
|
||||||
elif prevs - seen:
|
elif prevs - seen:
|
||||||
logger.info(
|
logger.info(
|
||||||
"Not fetching %d missing events for room %r,event %s: %r...",
|
"Not fetching %d missing events for room %r,event %s: %r...",
|
||||||
@ -178,8 +188,6 @@ class FederationHandler(BaseHandler):
|
|||||||
list(prevs - seen)[:5],
|
list(prevs - seen)[:5],
|
||||||
)
|
)
|
||||||
|
|
||||||
prevs = {e_id for e_id, _ in pdu.prev_events}
|
|
||||||
seen = set(have_seen.keys())
|
|
||||||
if prevs - seen:
|
if prevs - seen:
|
||||||
logger.info(
|
logger.info(
|
||||||
"Still missing %d events for room %r: %r...",
|
"Still missing %d events for room %r: %r...",
|
||||||
@ -214,19 +222,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
|
||||||
@ -288,19 +292,6 @@ class FederationHandler(BaseHandler):
|
|||||||
get_missing=False
|
get_missing=False
|
||||||
)
|
)
|
||||||
|
|
||||||
have_seen = yield self.store.have_events(
|
|
||||||
[ev for ev, _ in pdu.prev_events]
|
|
||||||
)
|
|
||||||
seen = set(have_seen.keys())
|
|
||||||
if prevs - seen:
|
|
||||||
logger.info(
|
|
||||||
"Still missing %d prev events for %s: %r...",
|
|
||||||
len(prevs - seen), pdu.event_id, list(prevs - seen)[:5]
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
logger.info("Found all missing prev events for %s", pdu.event_id)
|
|
||||||
defer.returnValue(have_seen)
|
|
||||||
|
|
||||||
@log_function
|
@log_function
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _process_received_pdu(self, origin, pdu, state, auth_chain):
|
def _process_received_pdu(self, origin, pdu, state, auth_chain):
|
||||||
|
Loading…
Reference in New Issue
Block a user