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

Batch up calls to get_rooms_for_users #14109

Merged
merged 2 commits into from
Oct 12, 2022

Conversation

Fizzadar
Copy link
Contributor

@Fizzadar Fizzadar commented Oct 8, 2022

This avoids blocking calls to the signular get_rooms_for_user when loading rooms for many users by batching the batched list calls.

To resolve: #14049

Signed off by Nick @ Beeper (@Fizzadar).

Pull Request Checklist

This avoids blocking calls to the signular `get_rooms_for_user` when
loading rooms for many users by batching the batched list calls.
@Fizzadar Fizzadar requested a review from a team as a code owner October 8, 2022 12:10
Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

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

Thanks. These kinds of unbounded-list queries do occasionally bite, I think, so good to address them when we become aware of them.

async def get_rooms_for_users(
self, user_ids: Collection[str]
) -> Dict[str, FrozenSet[str]]:
"""A batched wrapper around `_get_rooms_for_users`, to prevent locking
Copy link
Contributor

Choose a reason for hiding this comment

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

_get_rooms_for_users is itself a batched version of something else. It's batching all the way down! :-)

Copy link
Contributor

@reivilibre reivilibre left a comment

Choose a reason for hiding this comment

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

Misclick

@reivilibre reivilibre merged commit f9bc542 into matrix-org:develop Oct 12, 2022
clokep pushed a commit that referenced this pull request Oct 12, 2022
@Fizzadar Fizzadar deleted the batch-get-rooms-for-users-call branch January 24, 2023 10:53
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.

Sync workers get stuck, @cached call blocked by slow @cachedList query
2 participants