mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-24 20:39:22 -05:00
Speed up get_joined_hosts
This commit is contained in:
parent
b8492b6c2f
commit
13f540ef1b
@ -739,10 +739,11 @@ class RoomMemberHandler(BaseHandler):
|
|||||||
if len(current_state_ids) == 1 and create_event_id:
|
if len(current_state_ids) == 1 and create_event_id:
|
||||||
defer.returnValue(self.hs.is_mine_id(create_event_id))
|
defer.returnValue(self.hs.is_mine_id(create_event_id))
|
||||||
|
|
||||||
for (etype, state_key), event_id in current_state_ids.items():
|
for etype, state_key in current_state_ids:
|
||||||
if etype != EventTypes.Member or not self.hs.is_mine_id(state_key):
|
if etype != EventTypes.Member or not self.hs.is_mine_id(state_key):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
event_id = current_state_ids[(etype, state_key)]
|
||||||
event = yield self.store.get_event(event_id, allow_none=True)
|
event = yield self.store.get_event(event_id, allow_none=True)
|
||||||
if not event:
|
if not event:
|
||||||
continue
|
continue
|
||||||
|
@ -534,7 +534,7 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
assert state_group is not None
|
assert state_group is not None
|
||||||
|
|
||||||
joined_hosts = set()
|
joined_hosts = set()
|
||||||
for (etype, state_key), event_id in current_state_ids.items():
|
for etype, state_key in current_state_ids:
|
||||||
if etype == EventTypes.Member:
|
if etype == EventTypes.Member:
|
||||||
try:
|
try:
|
||||||
host = get_domain_from_id(state_key)
|
host = get_domain_from_id(state_key)
|
||||||
@ -545,6 +545,7 @@ class RoomMemberStore(SQLBaseStore):
|
|||||||
if host in joined_hosts:
|
if host in joined_hosts:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
event_id = current_state_ids[(etype, state_key)]
|
||||||
event = yield self.get_event(event_id, allow_none=True)
|
event = yield self.get_event(event_id, allow_none=True)
|
||||||
if event and event.content["membership"] == Membership.JOIN:
|
if event and event.content["membership"] == Membership.JOIN:
|
||||||
joined_hosts.add(intern_string(host))
|
joined_hosts.add(intern_string(host))
|
||||||
|
Loading…
Reference in New Issue
Block a user