notify cropper service on upload

This commit is contained in:
r888888888
2017-09-08 17:11:51 -07:00
parent 99e38c9e95
commit ff6a64f0fc
2 changed files with 22 additions and 8 deletions

View File

@@ -142,6 +142,7 @@ class Upload < ApplicationRecord
User.where(id: CurrentUser.id).update_all("post_upload_count = post_upload_count + 1")
create_artist_commentary(post) if include_artist_commentary?
ugoira_service.save_frame_data(post) if is_ugoira?
notify_cropper(post)
update_attributes(:status => "completed", :post_id => post.id)
else
update_attribute(:status, "error: " + post.errors.full_messages.join(", "))
@@ -197,6 +198,13 @@ class Upload < ApplicationRecord
end
end
end
def notify_cropper(post)
if Danbooru.config.aws_sqs_cropper_url && is_image?
sqs = SqsService.new(Danbooru.config.aws_sqs_cropper_url)
sqs.send_message("#{post.id},https://#{Danbooru.config.hostnames.first}/data/#{post.md5}.#{post.file_ext}")
end
end
end
module FileMethods