mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 14:03:22 +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:
parent
05a3e3670f
commit
e2dca641c6
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue
Block a user