Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Don't fetch state for missing events that we fetched #2170
Conversation
erikjohnston
assigned
richvdh
Apr 28, 2017
|
For the record, this was introduced in synapse 0.20, in 3406333 @erikjohnston: the intention was that |
richvdh
assigned
erikjohnston
and unassigned
richvdh
Apr 28, 2017
|
I think its more explicit to have it done in the outer function. WIll remove from _get_missing |
erikjohnston
assigned
richvdh
and unassigned
erikjohnston
Apr 28, 2017
| - ) | ||
| - else: | ||
| - logger.info("Found all missing prev events for %s", pdu.event_id) | ||
| - defer.returnValue(have_seen) |
richvdh
Apr 28, 2017
Member
there are other calls to defer.returnValue in this function; please update them too
also please update the docstring.
richvdh
Apr 28, 2017
Member
while you're in there, the docstring claims that prevs should be a list, which looks like a lie. my fault, but could you fix it?
| + [ev for ev, _ in pdu.prev_events] | ||
| + ) | ||
| + | ||
| + seen = set(have_seen.keys()) |
richvdh
Apr 28, 2017
Member
haven't we already got all this at https://github.com/matrix-org/synapse/pull/2170/files#diff-3f6de39b112e0c501c3c2925a571b908R199 ?
erikjohnston
May 2, 2017
Owner
have_seen has been updated the line above, and have_seen needs to be rechecked as we just fetched some missing events. Is that what you mean? Or do you mean we should wrap the call to have_seen and seen in a function?
| + # 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] |
richvdh
assigned
erikjohnston
and unassigned
richvdh
Apr 28, 2017
erikjohnston
assigned
richvdh
and unassigned
erikjohnston
Apr 28, 2017
richvdh
reviewed
May 2, 2017
still unclear why it looks like we're duplicating code here
richvdh
assigned
erikjohnston
and unassigned
richvdh
May 2, 2017
erikjohnston
assigned
richvdh
and unassigned
erikjohnston
May 2, 2017
|
I am completely failing to understand what you mean I'm afraid :( |
erikjohnston
assigned
erikjohnston
and unassigned
richvdh
May 3, 2017
erikjohnston
assigned
richvdh
and unassigned
erikjohnston
May 3, 2017
richvdh
approved these changes
May 3, 2017
this is a horrible, horrible bit of code
but I think it looks ok now
erikjohnston commentedApr 28, 2017
After fetching missing events we didn't update the list of events that were missing, so while we did successfully fetch the missing events it still thought it had a hole. This meant that it fetched the state, which adds delays, CPU time and increased DB usage (since we don't delta encode those state sets)