Rescue all errors when backfilling shas for uploads.

This commit is contained in:
Guo Xiang Tan 2016-08-23 15:05:37 +08:00
parent 90571f0364
commit f19232646f

View File

@ -71,11 +71,8 @@ task "uploads:backfill_shas" => :environment do
u.sha1 = Digest::SHA1.file(path).hexdigest u.sha1 = Digest::SHA1.file(path).hexdigest
u.save! u.save!
putc "." putc "."
rescue ActiveRecord::RecordInvalid rescue => e
puts "#{u.extension} is not valid" putc "Skipping #{upload.original_filename} (#{upload.url}) #{e.message}"
putc "X"
rescue Errno::ENOENT
putc "X"
end end
end end
end end