Great episode thx a lot.
I noticed something strange though. you create thumbnails based on the presence of the key attribute in the Painting class on the after_save
ruby
defenqueue_imageImageWorker.perform_async(id, key) if key.present?
end
but then you also set the key attribute in the perform method of the background task
ruby
defperform(id, key)
painting = Painting.find(id)
painting.key = key #setting the key again
painting.remote_image_url = painting.image.direct_fog_url(with_path:true)
painting.save! # enqueue_image will get called again
painting.update_column(:image_processed, true)
end
I think this will result in putting another message in the background queue. which will always keep your worker busy recreating thumbnails. Am I correct?
Great episode thx a lot.
I noticed something strange though. you create thumbnails based on the presence of the key attribute in the Painting class on the after_save
but then you also set the key attribute in the perform method of the background task
I think this will result in putting another message in the background queue. which will always keep your worker busy recreating thumbnails. Am I correct?