mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Merge pull request #252 from matrix-org/erikj/typing_loop
Don't loop over all rooms ever in typing.get_new_events_for_user
This commit is contained in:
commit
efdaa5dd55
@ -204,15 +204,11 @@ class TypingNotificationHandler(BaseHandler):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _push_update_local(self, room_id, user, typing):
|
def _push_update_local(self, room_id, user, typing):
|
||||||
if room_id not in self._room_serials:
|
room_set = self._room_typing.setdefault(room_id, set())
|
||||||
self._room_serials[room_id] = 0
|
|
||||||
self._room_typing[room_id] = set()
|
|
||||||
|
|
||||||
room_set = self._room_typing[room_id]
|
|
||||||
if typing:
|
if typing:
|
||||||
room_set.add(user)
|
room_set.add(user)
|
||||||
elif user in room_set:
|
else:
|
||||||
room_set.remove(user)
|
room_set.discard(user)
|
||||||
|
|
||||||
self._latest_room_serial += 1
|
self._latest_room_serial += 1
|
||||||
self._room_serials[room_id] = self._latest_room_serial
|
self._room_serials[room_id] = self._latest_room_serial
|
||||||
@ -260,8 +256,8 @@ class TypingNotificationEventSource(object):
|
|||||||
)
|
)
|
||||||
|
|
||||||
events = []
|
events = []
|
||||||
for room_id in handler._room_serials:
|
for room_id in joined_room_ids:
|
||||||
if room_id not in joined_room_ids:
|
if room_id not in handler._room_serials:
|
||||||
continue
|
continue
|
||||||
if handler._room_serials[room_id] <= from_key:
|
if handler._room_serials[room_id] <= from_key:
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user