Fix bug in persist events when dealing with non member types. (#7548)

`_is_server_still_joined` will throw if it is given state updates with non-user ID state keys with local user leaves. This is actually rarely a problem since local leaves almost always get persisted by themselves.

(I discovered this on a branch that was otherwise broken, so I haven't seen this in the wild)
This commit is contained in:
Erik Johnston 2020-05-21 13:20:10 +01:00 committed by GitHub
parent 5db2a59a86
commit f6f92845f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

1
changelog.d/7548.bugfix Normal file
View file

@ -0,0 +1 @@
Fix bug where a local user leaving a room could fail under rare circumstances.

View file

@ -740,8 +740,8 @@ class EventsPersistenceStorage(object):
# whose state has changed as we've already their new state above. # whose state has changed as we've already their new state above.
users_to_ignore = [ users_to_ignore = [
state_key state_key
for _, state_key in itertools.chain(delta.to_insert, delta.to_delete) for typ, state_key in itertools.chain(delta.to_insert, delta.to_delete)
if self.is_mine_id(state_key) if typ == EventTypes.Member and self.is_mine_id(state_key)
] ]
if await self.main_store.is_local_host_in_room_ignoring_users( if await self.main_store.is_local_host_in_room_ignoring_users(