mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 02:17:19 +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=Recipient.STREAM,
|
||||||
recipient__type_id__in=[stream.id for stream in target_streams],
|
recipient__type_id__in=[stream.id for stream in target_streams],
|
||||||
user_profile__is_active=True,
|
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)
|
result = dict((stream.id, []) for stream in streams)
|
||||||
for sub in subscriptions:
|
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
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user