mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +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)
 | 
					        return active_user_ids(user_profile.realm)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def realm_user_count(realm):
 | 
					def realm_user_count(realm):
 | 
				
			||||||
    user_dicts = get_active_user_dicts_in_realm(realm)
 | 
					    return UserProfile.objects.filter(realm=realm, is_active=True, is_bot=False).count()
 | 
				
			||||||
    return len([user_dict for user_dict in user_dicts if not user_dict["is_bot"]])
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
def send_signup_message(sender, signups_stream, user_profile,
 | 
					def send_signup_message(sender, signups_stream, user_profile,
 | 
				
			||||||
                        internal=False, realm=None):
 | 
					                        internal=False, realm=None):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user