Please read for an updated status on RailsCasts:
Learn more or hide this
GitHub User: shadysayed
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
ImageWorker.perform_async(id, key) if key.present?
but then you also set the key attribute in the perform method of the background task
def perform(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
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?