Handle None state group correctly

This commit is contained in:
Erik Johnston 2017-05-26 10:46:03 +01:00
parent 23da638360
commit 619e8ecd0c
2 changed files with 7 additions and 4 deletions

View File

@ -364,11 +364,11 @@ class StateHandler(object):
prev_group = None prev_group = None
delta_ids = None delta_ids = None
for old_group, old_ids in state_groups_ids.items(): for old_group, old_ids in state_groups_ids.iteritems():
if not set(new_state.iterkeys()) - set(old_ids.iterkeys()): if not set(new_state) - set(old_ids):
n_delta_ids = { n_delta_ids = {
k: v k: v
for k, v in new_state.items() for k, v in new_state.iteritems()
if old_ids.get(k) != v if old_ids.get(k) != v
} }
if not delta_ids or len(n_delta_ids) < len(delta_ids): if not delta_ids or len(n_delta_ids) < len(delta_ids):

View File

@ -692,7 +692,10 @@ class _JoinedHostsCache(object):
host = intern_string(get_domain_from_id(user_id)) host = intern_string(get_domain_from_id(user_id))
self.hosts_to_joined_users.setdefault(host, set()).add(user_id) self.hosts_to_joined_users.setdefault(host, set()).add(user_id)
self.state_group = state_entry.state_group if state_entry.state_group:
self.state_group = state_entry.state_group
else:
self.state_group = object()
self._len = sum(len(v) for v in self.hosts_to_joined_users.itervalues()) self._len = sum(len(v) for v in self.hosts_to_joined_users.itervalues())
defer.returnValue(frozenset(self.hosts_to_joined_users)) defer.returnValue(frozenset(self.hosts_to_joined_users))