mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 05:23:35 +00:00
export-search: Prefetch message sender.
This avoids O(n) extra queries.
(cherry picked from commit ae090d9ff3)
This commit is contained in:
committed by
Tim Abbott
parent
5351f9cc0c
commit
270a19984a
@@ -201,7 +201,11 @@ This is most often used for legal compliance.
|
||||
limits &= Q(recipient__in=[s.recipient_id for s in channels])
|
||||
|
||||
attachments_written: set[str] = set()
|
||||
messages_query = Message.objects.filter(limits, realm=realm).order_by("date_sent")
|
||||
messages_query = (
|
||||
Message.objects.filter(limits, realm=realm)
|
||||
.select_related("sender")
|
||||
.order_by("date_sent")
|
||||
)
|
||||
print(f"Exporting {len(messages_query)} messages...")
|
||||
|
||||
@lru_cache(maxsize=1000)
|
||||
|
||||
Reference in New Issue
Block a user