Fix bug with reusing 'txn' when persisting event. (#10743)

This will only happen when a server has multiple out of band membership
events in a single room.
This commit is contained in:
Erik Johnston 2021-09-03 10:59:25 +01:00 committed by GitHub
parent 00640ee71a
commit f58d202e3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

1
changelog.d/10743.bugfix Normal file
View File

@ -0,0 +1 @@
Fix edge case when persisting events into a room where there are multiple events we previously hadn't calculated auth chains for (and hadn't marked as needing to be calculated).

View File

@ -575,7 +575,13 @@ class PersistEventsStore:
missing_auth_chains.clear()
for auth_id, event_type, state_key, chain_id, sequence_number in txn:
for (
auth_id,
event_type,
state_key,
chain_id,
sequence_number,
) in txn.fetchall():
event_to_types[auth_id] = (event_type, state_key)
if chain_id is None: