This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/jobs/regular/update_post_uploads_secure_status.rb
Bianca Nenciu d1b2e9db3b
PERF: Update post uploads secure status in a job (#13459)
When secure uploads are enabled, editing a post with many uploads can
cause a timeout because the store has to be contacted for each upload.
2021-06-21 19:15:24 +03:00

15 lines
316 B
Ruby

# frozen_string_literal: true
module Jobs
class UpdatePostUploadsSecureStatus < ::Jobs::Base
def execute(args)
post = Post.find_by(id: args[:post_id])
return if post.blank?
post.uploads.each do |upload|
upload.update_secure_status(source: args[:source])
end
end
end
end