-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Improve performance of getting typing updates for replication #3794
Conversation
Fetching the list of all new typing notifications involved iterating over all rooms and comparing their serial. Lets move to using a stream change cache, like we do for other streams.
@matrixbot retest this please |
d3cbc91
to
1a24d4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i has questions
if last_id < serial and serial <= current_id: | ||
for room_id in changed_rooms: | ||
serial = self._room_serials[room_id] | ||
if last_id < serial <= current_id: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL you can do this in python.
for room_id, serial in self._room_serials.items(): | ||
if last_id < serial and serial <= current_id: | ||
for room_id in changed_rooms: | ||
serial = self._room_serials[room_id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we bother to update and check room_serials as well as the stream change cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly because the stream change caches are bound in size and will drop old rooms. Agreed its a bit wasteful to have both, but I'm not sure the best way of amalgamating them without causing us to send down all typing notifications for old clients.
last_id, | ||
) | ||
|
||
if changed_rooms is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see why this would happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_all_entities_changed
can return None
if last_id
is sufficiently old?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I swear I meant to approve this days ago
(oh, I was going to grumble about lack of comments to explain what was going on. nm.) |
Fetching the list of all new typing notifications involved iterating
over all rooms and comparing their serial. Lets move to using a stream
change cache, like we do for other streams.