mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Remove optimized_images_preloaded kwarg from FileStore::S3Store#update_upload_ACL (#31087)
The optimization is not required because `find_each` fetches records in batches of 1000 and no upload record will have more than 1000 optimized images.
This commit is contained in:
committed by
GitHub
parent
5bc7371192
commit
76ade65a26
@@ -19,7 +19,7 @@ module Jobs
|
||||
.find_in_batches do |uploads|
|
||||
uploads.each do |upload|
|
||||
begin
|
||||
Discourse.store.update_upload_ACL(upload, optimized_images_preloaded: true)
|
||||
Discourse.store.update_upload_ACL(upload)
|
||||
rescue => err
|
||||
Discourse.warn_exception(
|
||||
err,
|
||||
|
||||
@@ -311,22 +311,12 @@ module FileStore
|
||||
end
|
||||
end
|
||||
|
||||
def update_upload_ACL(upload, optimized_images_preloaded: false)
|
||||
def update_upload_ACL(upload)
|
||||
key = get_upload_key(upload)
|
||||
update_ACL(key, upload.secure?)
|
||||
|
||||
# If we do find_each when the images have already been preloaded with
|
||||
# includes(:optimized_images), then the optimized_images are fetched
|
||||
# from the database again, negating the preloading if this operation
|
||||
# is done on a large amount of uploads at once (see Jobs::SyncAclsForUploads)
|
||||
if optimized_images_preloaded
|
||||
upload.optimized_images.each do |optimized_image|
|
||||
update_optimized_image_acl(optimized_image, secure: upload.secure)
|
||||
end
|
||||
else
|
||||
upload.optimized_images.find_each do |optimized_image|
|
||||
update_optimized_image_acl(optimized_image, secure: upload.secure)
|
||||
end
|
||||
upload.optimized_images.each do |optimized_image|
|
||||
update_optimized_image_acl(optimized_image, secure: upload.secure)
|
||||
end
|
||||
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user