mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Merge pull request #1862 from matrix-org/erikj/presence_update
Use DB cache of joined users for presence
This commit is contained in:
commit
bfb3d255b1
@ -574,7 +574,7 @@ class PresenceHandler(object):
|
|||||||
if not local_states:
|
if not local_states:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
users = yield self.state.get_current_user_in_room(room_id)
|
users = yield self.store.get_users_in_room(room_id)
|
||||||
hosts = set(get_domain_from_id(u) for u in users)
|
hosts = set(get_domain_from_id(u) for u in users)
|
||||||
|
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
@ -766,7 +766,7 @@ class PresenceHandler(object):
|
|||||||
# don't need to send to local clients here, as that is done as part
|
# don't need to send to local clients here, as that is done as part
|
||||||
# of the event stream/sync.
|
# of the event stream/sync.
|
||||||
# TODO: Only send to servers not already in the room.
|
# TODO: Only send to servers not already in the room.
|
||||||
user_ids = yield self.state.get_current_user_in_room(room_id)
|
user_ids = yield self.store.get_users_in_room(room_id)
|
||||||
if self.is_mine(user):
|
if self.is_mine(user):
|
||||||
state = yield self.current_state_for_user(user.to_string())
|
state = yield self.current_state_for_user(user.to_string())
|
||||||
|
|
||||||
@ -1069,7 +1069,7 @@ class PresenceEventSource(object):
|
|||||||
|
|
||||||
user_ids_to_check = set()
|
user_ids_to_check = set()
|
||||||
for room_id in room_ids:
|
for room_id in room_ids:
|
||||||
users = yield self.state.get_current_user_in_room(room_id)
|
users = yield self.store.get_users_in_room(room_id)
|
||||||
user_ids_to_check.update(users)
|
user_ids_to_check.update(users)
|
||||||
|
|
||||||
user_ids_to_check.update(friends)
|
user_ids_to_check.update(friends)
|
||||||
|
@ -564,9 +564,13 @@ class EventsStore(SQLBaseStore):
|
|||||||
)
|
)
|
||||||
|
|
||||||
for member in members_changed:
|
for member in members_changed:
|
||||||
txn.call_after(self.get_rooms_for_user.invalidate, (member,))
|
self._invalidate_cache_and_stream(
|
||||||
|
txn, self.get_rooms_for_user, (member,)
|
||||||
|
)
|
||||||
|
|
||||||
txn.call_after(self.get_users_in_room.invalidate, (room_id,))
|
self._invalidate_cache_and_stream(
|
||||||
|
txn, self.get_users_in_room, (room_id,)
|
||||||
|
)
|
||||||
|
|
||||||
# Add an entry to the current_state_resets table to record the point
|
# Add an entry to the current_state_resets table to record the point
|
||||||
# where we clobbered the current state
|
# where we clobbered the current state
|
||||||
|
Loading…
Reference in New Issue
Block a user