mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-22 06:14:09 -04:00
Don't return weird prev_group
This commit is contained in:
parent
dbc0dfd2d5
commit
2b03751c3c
1 changed files with 13 additions and 8 deletions
|
@ -195,12 +195,12 @@ class StateHandler(object):
|
||||||
Returns:
|
Returns:
|
||||||
synapse.events.snapshot.EventContext:
|
synapse.events.snapshot.EventContext:
|
||||||
"""
|
"""
|
||||||
context = EventContext()
|
|
||||||
|
|
||||||
if event.internal_metadata.is_outlier():
|
if event.internal_metadata.is_outlier():
|
||||||
# If this is an outlier, then we know it shouldn't have any current
|
# If this is an outlier, then we know it shouldn't have any current
|
||||||
# state. Certainly store.get_current_state won't return any, and
|
# state. Certainly store.get_current_state won't return any, and
|
||||||
# persisting the event won't store the state group.
|
# persisting the event won't store the state group.
|
||||||
|
context = EventContext()
|
||||||
if old_state:
|
if old_state:
|
||||||
context.prev_state_ids = {
|
context.prev_state_ids = {
|
||||||
(s.type, s.state_key): s.event_id for s in old_state
|
(s.type, s.state_key): s.event_id for s in old_state
|
||||||
|
@ -219,6 +219,7 @@ class StateHandler(object):
|
||||||
defer.returnValue(context)
|
defer.returnValue(context)
|
||||||
|
|
||||||
if old_state:
|
if old_state:
|
||||||
|
context = EventContext()
|
||||||
context.prev_state_ids = {
|
context.prev_state_ids = {
|
||||||
(s.type, s.state_key): s.event_id for s in old_state
|
(s.type, s.state_key): s.event_id for s in old_state
|
||||||
}
|
}
|
||||||
|
@ -245,6 +246,7 @@ class StateHandler(object):
|
||||||
|
|
||||||
curr_state = entry.state
|
curr_state = entry.state
|
||||||
|
|
||||||
|
context = EventContext()
|
||||||
context.prev_state_ids = curr_state
|
context.prev_state_ids = curr_state
|
||||||
if event.is_state():
|
if event.is_state():
|
||||||
context.state_group = self.store.get_next_state_group()
|
context.state_group = self.store.get_next_state_group()
|
||||||
|
@ -257,11 +259,14 @@ class StateHandler(object):
|
||||||
context.current_state_ids = dict(context.prev_state_ids)
|
context.current_state_ids = dict(context.prev_state_ids)
|
||||||
context.current_state_ids[key] = event.event_id
|
context.current_state_ids[key] = event.event_id
|
||||||
|
|
||||||
context.prev_group = entry.prev_group
|
if entry.state_group:
|
||||||
context.delta_ids = entry.delta_ids
|
context.prev_group = entry.state_group
|
||||||
if context.delta_ids is not None:
|
context.delta_ids = {
|
||||||
context.delta_ids = dict(context.delta_ids)
|
key: event.event_id
|
||||||
context.delta_ids[key] = event.event_id
|
}
|
||||||
|
elif entry.prev_group:
|
||||||
|
context.prev_group = entry.prev_group
|
||||||
|
context.delta_ids = entry.delta_ids
|
||||||
else:
|
else:
|
||||||
if entry.state_group is None:
|
if entry.state_group is None:
|
||||||
entry.state_group = self.store.get_next_state_group()
|
entry.state_group = self.store.get_next_state_group()
|
||||||
|
@ -305,8 +310,8 @@ class StateHandler(object):
|
||||||
defer.returnValue(_StateCacheEntry(
|
defer.returnValue(_StateCacheEntry(
|
||||||
state=state_list,
|
state=state_list,
|
||||||
state_group=name,
|
state_group=name,
|
||||||
prev_group=name,
|
prev_group=None,
|
||||||
delta_ids={},
|
delta_ids=None,
|
||||||
))
|
))
|
||||||
|
|
||||||
with (yield self.resolve_linearizer.queue(group_names)):
|
with (yield self.resolve_linearizer.queue(group_names)):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue