mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 02:48:00 +00:00
bulk_get_subscriber_emails: Use .values() to substantially improve performance.
(imported from commit b37738d670930cdf65687a8526d8a8f47835b42b)
This commit is contained in:
@@ -644,11 +644,11 @@ def bulk_get_subscriber_emails(streams, user_profile):
|
||||
recipient__type=Recipient.STREAM,
|
||||
recipient__type_id__in=[stream.id for stream in target_streams],
|
||||
user_profile__is_active=True,
|
||||
active=True).only("user_profile__email", "recipient__type_id")
|
||||
active=True).values("user_profile__email", "recipient__type_id")
|
||||
|
||||
result = dict((stream.id, []) for stream in streams)
|
||||
for sub in subscriptions:
|
||||
result[sub.recipient.type_id].append(sub.user_profile.email)
|
||||
result[sub["recipient__type_id"]].append(sub["user_profile__email"])
|
||||
|
||||
return result
|
||||
|
||||
|
||||
Reference in New Issue
Block a user