soft_deactivation: Do not bother to fetch stream data as well.

This prefetch is unnecessary and makes this query load more data than
needed.

Existing tests verify that this does not add more queries.
This commit is contained in:
Alex Vandiver
2023-04-28 18:47:18 +00:00
committed by Tim Abbott
parent 2deec692f6
commit ae7485a96e

View File

@@ -176,8 +176,7 @@ def add_missing_messages(user_profile: UserProfile) -> None:
# meantime. Without that tiebreak, we could end up incorrectly
# processing the ordering of those two subscription changes.
subscription_logs = list(
RealmAuditLog.objects.select_related("modified_stream")
.filter(
RealmAuditLog.objects.filter(
modified_user=user_profile, modified_stream_id__in=stream_ids, event_type__in=events
)
.order_by("event_last_message_id", "id")