Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

thumbnail: Set a stable ordering on ImageAttachment rows for locking.

Alex Vandiveref21dd9b9900
diff --git a/zerver/lib/thumbnail.py b/zerver/lib/thumbnail.py
index f15303fdf47..0acdf9aaf6b 100644
--- a/zerver/lib/thumbnail.py
+++ b/zerver/lib/thumbnail.py
@@ -347,7 +347,9 @@ def get_user_upload_previews(
upload_preview_data: dict[str, MarkdownImageMetadata] = {}
- image_attachments = ImageAttachment.objects.filter(realm_id=realm_id, path_id__in=path_ids)
+ image_attachments = ImageAttachment.objects.filter(
+ realm_id=realm_id, path_id__in=path_ids
+ ).order_by("id")
if lock:
image_attachments = image_attachments.select_for_update()
for image_attachment in image_attachments: