fix amazonbackup script, trap on epipe exception for db backup

This commit is contained in:
r888888888
2014-01-10 16:35:40 -08:00
parent cb629613bd
commit 782bdd4627
3 changed files with 20 additions and 4 deletions

View File

@@ -24,7 +24,7 @@ class AmazonBackup < ActiveRecord::Base
AWS::S3::S3Object.store(File.basename(post.file_path), open(post.file_path, "rb"), Danbooru.config.amazon_s3_bucket_name, "Content-MD5" => base64_md5)
end
if post.image? && File.exists?(post.preview_file_path)
if post.is_image? && File.exists?(post.preview_file_path)
AWS::S3::S3Object.store("preview/#{post.md5}.jpg", open(post.preview_file_path, "rb"), Danbooru.config.amazon_s3_bucket_name)
end
@@ -32,7 +32,7 @@ class AmazonBackup < ActiveRecord::Base
AWS::S3::S3Object.store("large/#{post.md5}.jpg", open(post.large_file_path, "rb"), Danbooru.config.amazon_s3_bucket_name)
end
AmazonBackup.update_id(last_id)
AmazonBackup.update_id(post.id)
end
rescue Exception => x
# probably some network error, retry next time