-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Don't fetch state for missing events that we fetched #2170
Changes from 2 commits
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 |
---|---|---|
|
@@ -171,6 +171,23 @@ def on_receive_pdu(self, origin, pdu, get_missing=True): | |
yield self._get_missing_events_for_pdu( | ||
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( | ||
[ev for ev, _ in pdu.prev_events] | ||
) | ||
|
||
seen = set(have_seen.keys()) | ||
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. haven't we already got all this at https://github.com/matrix-org/synapse/pull/2170/files#diff-3f6de39b112e0c501c3c2925a571b908R199 ? 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. no? 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. well, it looks very similar to me. what's the difference? 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.
|
||
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 | ||
) | ||
elif prevs - seen: | ||
logger.info( | ||
"Not fetching %d missing events for room %r,event %s: %r...", | ||
|
@@ -288,19 +305,6 @@ def _get_missing_events_for_pdu(self, origin, pdu, prevs, min_depth): | |
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) | ||
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. there are other calls to also please update the docstring. 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. while you're in there, the docstring claims that 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. Done |
||
|
||
@log_function | ||
@defer.inlineCallbacks | ||
def _process_received_pdu(self, origin, pdu, state, auth_chain): | ||
|
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.
use
prevs
here?