fix async processing for ugoira

This commit is contained in:
r888888888
2014-10-22 22:48:20 -07:00
parent e8f973601c
commit 69564c4bff
4 changed files with 90 additions and 89 deletions

View File

@@ -17,7 +17,7 @@ module Downloads
end
# http://i2.pixiv.net/img-zip-ugoira/img/2014/08/05/06/01/10/44524589_ugoira1920x1080.zip
if url =~ %r!\Ahttps?://i[12]\.pixiv\.net/img-zip-ugoira/img/\d{4}/\d{2}/\d{2}/\d{2}/\d{2}/\d{2}/\d+_ugoira\d+x\d+\.zip\z!i
if url =~ %r!\Ahttps?://i\d+\.pixiv\.net/img-zip-ugoira/img/\d{4}/\d{2}/\d{2}/\d{2}/\d{2}/\d{2}/\d+_ugoira\d+x\d+\.zip\z!i
data[:ugoira_frame_data] = source.ugoira_frame_data
data[:ugoira_width] = source.ugoira_width
data[:ugoira_height] = source.ugoira_height

View File

@@ -10,7 +10,8 @@ class PixivUgoiraService
end
def generate_resizes(source_path, output_path, preview_path)
PixivUgoiraConverter.delay(:queue => Socket.gethostname).convert(source_path, output_path, preview_path, @frame_data)
# Run this a bit in the future to give the upload process time to move the file
PixivUgoiraConverter.delay(:queue => Socket.gethostname, :run_at => 2.seconds.from_now).convert(source_path, output_path, preview_path, @frame_data)
# since the resizes will be delayed, just touch the output file so the
# file distribution wont break