mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 03:11:54 +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:
@@ -133,10 +133,10 @@ def bulk_create_users(
|
||||
Subscription.objects.bulk_create(subscriptions_to_create)
|
||||
|
||||
full_members_system_group = NamedUserGroup.objects.get(
|
||||
name=SystemGroups.FULL_MEMBERS, realm=realm, is_system_group=True
|
||||
name=SystemGroups.FULL_MEMBERS, realm_for_sharding=realm, is_system_group=True
|
||||
)
|
||||
members_system_group = NamedUserGroup.objects.get(
|
||||
name=SystemGroups.MEMBERS, realm=realm, is_system_group=True
|
||||
name=SystemGroups.MEMBERS, realm_for_sharding=realm, is_system_group=True
|
||||
)
|
||||
group_memberships_to_create: list[UserGroupMembership] = []
|
||||
for user_profile in profiles_to_create:
|
||||
|
||||
Reference in New Issue
Block a user