fix pixiv tests

This commit is contained in:
r888888888
2014-10-20 20:49:17 -07:00
parent 260de869b1
commit 8d4c9d7955
95 changed files with 146368 additions and 31275 deletions

View File

@@ -112,7 +112,7 @@ class Upload < ActiveRecord::Base
post.distribute_files
if post.save
CurrentUser.increment!(:post_upload_count)
ugoira_service.process(post)
ugoira_service.process(post) if is_ugoira?
update_attributes(:status => "completed", :post_id => post.id)
else
update_attribute(:status, "error: " + post.errors.full_messages.join(", "))
@@ -138,7 +138,17 @@ class Upload < ActiveRecord::Base
update_attributes(:status => "error: #{x.class} - #{x.message}", :backtrace => x.backtrace.join("\n"))
ensure
delete_temp_file
if async_conversion?
# need to delay this because we have to process the file
# before deleting it
delay(:queue => Socket.gethostname).delete_temp_file(temp_file_path)
else
delete_temp_file
end
end
def async_conversion?
is_ugoira?
end
def ugoira_service
@@ -167,8 +177,8 @@ class Upload < ActiveRecord::Base
end
module FileMethods
def delete_temp_file
FileUtils.rm_f(temp_file_path)
def delete_temp_file(path = nil)
FileUtils.rm_f(path || temp_file_path)
end
def move_file