mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
handle exceptions in s3:correct_acl task
We need to handle arbitrary exceptions in this task, especially since the task is not easily resumable. Simply output problem uploads as you hit them for now.
This commit is contained in:
@ -120,9 +120,13 @@ task 's3:correct_acl' => :environment do
|
||||
if !url.start_with?(base_url)
|
||||
puts "Skipping #{type} #{id} since it is not stored on s3, url is #{url}"
|
||||
else
|
||||
key = url[(base_url.length + 1)..-1]
|
||||
object = Discourse.store.s3_helper.object(key)
|
||||
object.acl.put(acl: "public-read")
|
||||
begin
|
||||
key = url[(base_url.length + 1)..-1]
|
||||
object = Discourse.store.s3_helper.object(key)
|
||||
object.acl.put(acl: "public-read")
|
||||
rescue => e
|
||||
puts "Skipping #{type} #{id} url is #{url} #{e}"
|
||||
end
|
||||
end
|
||||
if i % 100 == 0
|
||||
puts "#{i} done"
|
||||
|
Reference in New Issue
Block a user