Merge pull request #3603 from matrix-org/erikj/handle_outliers
Correctly handle outliers during persist events
This commit is contained in:
commit
3849f7f69f
|
@ -0,0 +1 @@
|
||||||
|
Fix failure to persist events over federation under load
|
|
@ -574,11 +574,13 @@ class EventsStore(EventsWorkerStore):
|
||||||
|
|
||||||
for ev, ctx in events_context:
|
for ev, ctx in events_context:
|
||||||
if ctx.state_group is None:
|
if ctx.state_group is None:
|
||||||
# I don't think this can happen, but let's double-check
|
# This should only happen for outlier events.
|
||||||
raise Exception(
|
if not ev.internal_metadata.is_outlier():
|
||||||
"Context for new extremity event %s has no state "
|
raise Exception(
|
||||||
"group" % (ev.event_id, ),
|
"Context for new event %s has no state "
|
||||||
)
|
"group" % (ev.event_id, ),
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
|
||||||
if ctx.state_group in state_groups_map:
|
if ctx.state_group in state_groups_map:
|
||||||
continue
|
continue
|
||||||
|
@ -606,7 +608,7 @@ class EventsStore(EventsWorkerStore):
|
||||||
for event_id in new_latest_event_ids:
|
for event_id in new_latest_event_ids:
|
||||||
# First search in the list of new events we're adding.
|
# First search in the list of new events we're adding.
|
||||||
for ev, ctx in events_context:
|
for ev, ctx in events_context:
|
||||||
if event_id == ev.event_id:
|
if event_id == ev.event_id and ctx.state_group is not None:
|
||||||
event_id_to_state_group[event_id] = ctx.state_group
|
event_id_to_state_group[event_id] = ctx.state_group
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue