Fix mainline ordering in state res v2 (#8971)

This had two effects 1) it'd give the wrong answer and b) would iterate
*all* power levels in the auth chain of each event. The latter of which
can be *very* expensive for certain types of IRC bridge rooms that have
large numbers of power level changes.
This commit is contained in:
Erik Johnston 2020-12-18 15:00:34 +00:00 committed by GitHub
parent 28877fade9
commit 5e7d75daa2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 58 additions and 2 deletions

View file

@ -658,7 +658,7 @@ async def _get_mainline_depth_for_event(
# We do an iterative search, replacing `event with the power level in its
# auth events (if any)
while tmp_event:
depth = mainline_map.get(event.event_id)
depth = mainline_map.get(tmp_event.event_id)
if depth is not None:
return depth