mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
upload: Serve thumbnailed images.
This commit is contained in:
committed by
Tim Abbott
parent
2e38f426f4
commit
d121a80b78
@@ -24,6 +24,11 @@ class ThumbnailWorker(QueueProcessingWorker):
|
||||
start = time.time()
|
||||
with transaction.atomic(savepoint=False):
|
||||
try:
|
||||
# This lock prevents us from racing with the on-demand
|
||||
# rendering that can be triggered if a request is made
|
||||
# directly to a thumbnail URL we have not made yet.
|
||||
# This may mean that we may generate 0 thumbnail
|
||||
# images once we get the lock.
|
||||
row = ImageAttachment.objects.select_for_update().get(id=event["id"])
|
||||
except ImageAttachment.DoesNotExist: # nocoverage
|
||||
logger.info("ImageAttachment row %d missing", event["id"])
|
||||
|
||||
Reference in New Issue
Block a user