mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 20:41:46 +00:00
groups: Use realm_for_sharding for limiting NamedUserGroup queries.
For get and filter queries of NamedUserGroup, realm_for_sharding field is used instead of realm field, as directly using realm_for_sharding field on NamedUserGroup makes the query faster than using realm present on the base UserGroup table.
This commit is contained in:
@@ -380,7 +380,9 @@ def get_mentioned_user_group(
|
||||
# all these messages.
|
||||
smallest_user_group_size = math.inf
|
||||
for user_group_id in mentioned_user_group_ids:
|
||||
current_user_group = NamedUserGroup.objects.get(id=user_group_id, realm=user_profile.realm)
|
||||
current_user_group = NamedUserGroup.objects.get(
|
||||
id=user_group_id, realm_for_sharding=user_profile.realm
|
||||
)
|
||||
current_mentioned_user_group = MentionedUserGroup(
|
||||
id=current_user_group.id,
|
||||
name=current_user_group.name,
|
||||
|
||||
Reference in New Issue
Block a user