mirror of
https://mau.dev/maunium/synapse.git
synced 2024-09-01 23:45:22 +02:00
Check that events being persisted have state_group
This commit is contained in:
parent
447aed42d2
commit
9fcbbe8e7d
1 changed files with 9 additions and 4 deletions
|
@ -515,16 +515,21 @@ class EventsStore(SQLBaseStore):
|
||||||
if ctx.current_state_ids is None:
|
if ctx.current_state_ids is None:
|
||||||
raise Exception("Unknown current state")
|
raise Exception("Unknown current state")
|
||||||
|
|
||||||
|
if ctx.state_group is None:
|
||||||
|
# I don't think this can happen, but let's double-check
|
||||||
|
raise Exception(
|
||||||
|
"Context for new extremity event %s has no state "
|
||||||
|
"group" % event_id,
|
||||||
|
)
|
||||||
|
|
||||||
# If we've already seen the state group don't bother adding
|
# If we've already seen the state group don't bother adding
|
||||||
# it to the state sets again
|
# it to the state sets again
|
||||||
if ctx.state_group not in state_groups:
|
if ctx.state_group not in state_groups:
|
||||||
state_sets.append(ctx.current_state_ids)
|
state_sets.append(ctx.current_state_ids)
|
||||||
if ctx.delta_ids or hasattr(ev, "state_key"):
|
if ctx.delta_ids or hasattr(ev, "state_key"):
|
||||||
was_updated = True
|
was_updated = True
|
||||||
if ctx.state_group:
|
# Add this as a seen state group
|
||||||
# Add this as a seen state group (if it has a state
|
state_groups.add(ctx.state_group)
|
||||||
# group)
|
|
||||||
state_groups.add(ctx.state_group)
|
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# If we couldn't find it, then we'll need to pull
|
# If we couldn't find it, then we'll need to pull
|
||||||
|
|
Loading…
Reference in a new issue