Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Improve performance of getting typing updates for replication #3794

Merged
merged 3 commits into from
Sep 27, 2018

Conversation

erikjohnston
Copy link
Member

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.

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.
@erikjohnston erikjohnston requested a review from a team September 5, 2018 09:23
@erikjohnston
Copy link
Member Author

@matrixbot retest this please

Copy link
Member

@richvdh richvdh left a 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:
Copy link
Member

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]
Copy link
Member

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?

Copy link
Member Author

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:
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

@richvdh richvdh left a 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

@richvdh richvdh merged commit 36c62a6 into develop Sep 27, 2018
@richvdh richvdh deleted the erikj/faster_typing branch September 27, 2018 14:14
@richvdh
Copy link
Member

richvdh commented Sep 27, 2018

(oh, I was going to grumble about lack of comments to explain what was going on. nm.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants