Add FrozenEvent.get_state_key and use it in a couple of places (#11793)

This is more efficient, since we only have to look up `state_key` in the event
dict once, rather than three (!) times.
This commit is contained in:
Richard van der Hoff 2022-01-21 09:10:01 +00:00 committed by GitHub
parent 4c2096599c
commit c027bc0e4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View file

@ -163,7 +163,7 @@ class EventContext:
return {
"prev_state_id": prev_state_id,
"event_type": event.type,
"event_state_key": event.state_key if event.is_state() else None,
"event_state_key": event.get_state_key(),
"state_group": self._state_group,
"state_group_before_event": self.state_group_before_event,
"rejected": self.rejected,