mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
Simplify realm_user_count to do just do a database count() query.
Just doing the database query is more readable, and has about the same performance as before in the case where active user dicts for the realm are in cache (and is substantially better in the rare case that this isn't in the cache). Thanks to @dbiollo for the perf investigation and suggestion!
This commit is contained in:
@@ -112,8 +112,7 @@ def bot_owner_userids(user_profile):
|
||||
return active_user_ids(user_profile.realm)
|
||||
|
||||
def realm_user_count(realm):
|
||||
user_dicts = get_active_user_dicts_in_realm(realm)
|
||||
return len([user_dict for user_dict in user_dicts if not user_dict["is_bot"]])
|
||||
return UserProfile.objects.filter(realm=realm, is_active=True, is_bot=False).count()
|
||||
|
||||
def send_signup_message(sender, signups_stream, user_profile,
|
||||
internal=False, realm=None):
|
||||
|
||||
Reference in New Issue
Block a user