delete_in_topic: Don't unnecessarily fetch .recipient.

This reverts commit f119c33789.
With 51cef01c29 merged, there is no need
to fetch .recipient here, as it won't be accessed by the delete messages
codepath.
This commit is contained in:
Mateusz Mandera
2025-08-23 02:20:52 +08:00
committed by Tim Abbott
parent cacc89e4d0
commit 5ef6852cfe

View File

@@ -1323,10 +1323,8 @@ def delete_in_topic(
if time.monotonic() >= start_time + 50:
return json_success(request, data={"complete": False})
with transaction.atomic(durable=True):
messages_to_delete = (
messages.select_related("recipient")
.order_by("-id")[0:batch_size]
.select_for_update(of=("self",))
messages_to_delete = messages.order_by("-id")[0:batch_size].select_for_update(
of=("self",)
)
if not messages_to_delete:
break