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

Improve caching for read_marker API #2927

Merged
merged 3 commits into from
Mar 1, 2018
Merged

Conversation

erikjohnston
Copy link
Member

(I've also added some sytests matrix-org/sytest#433)

@erikjohnston
Copy link
Member Author

erikjohnston commented Mar 1, 2018

The failed Sytest is failing on If remote user leaves room we no longer receive device updates, which feels spurious. Though somewhat worrying.

@erikjohnston
Copy link
Member Author

The other sytest failed because perl failed to install Alien::Sodium

@@ -156,6 +157,38 @@ def get_account_data_for_room_txn(txn):
"get_account_data_for_room", get_account_data_for_room_txn
)

@cached(num_args=3, max_entries=5000)
def get_account_data_for_room_and_type(self, user_id, room_id, account_data_type):
"""Get all the client account_data for a user for a room.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LIES

room_id(str): The room to get the account_data for.
account_data_type (str): The account data type to get.
Returns:
A deferred dict of the room account_data for that type, or None if
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessarily a dict?

@@ -2033,7 +2033,7 @@ def is_event_after(self, event_id1, event_id2):
to_2, so_2 = yield self._get_event_ordering(event_id2)
defer.returnValue((to_1, so_1) > (to_2, so_2))

@defer.inlineCallbacks
@cachedInlineCallbacks(max_entries=5000)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd really prefer it if we used

@cached()
@defer.inlineCallbacks

but I'm not going to argue too much about it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me too, but I think this is something to be investigated outside this PR.

@richvdh richvdh assigned erikjohnston and unassigned richvdh Mar 1, 2018
We add a new storage function to get a paritcular type of room account
data. This allows us to prefill the cache when updating that acount
data.
@erikjohnston erikjohnston force-pushed the erikj/read_marker_caches branch from 5d72c68 to 4b44f05 Compare March 1, 2018 17:08
@erikjohnston erikjohnston merged commit 9e08a93 into develop Mar 1, 2018
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