Pergunta

I'm currently trying to set up Carrierwave + Carrierwave_Backgrounder + Resque. Carrierwave on its own works like a charm. You can upload images and they get processed and different versions are created. Then I added Carrierwave_Backgrounder + Resque and carrierwave produces jobs that are pushed into the queue... all good. But only the original file is saved. There is no sign of any image getting processed. I've been trying for hours now to look if someone had the same problem but I wasn't really successful. I'm not using S3 or something like that. I just want to store everything locally and let the processing run in the background. I tried process_in_background and store_in_background. No real difference except that the original image gets saved in the temp folder.

I also tried the process! or recreate_versions! methods on post.image in the console ... but also no luck there. Maybe a clue? For recreate_versions! I just get [:store_versions!] ... then I tried save! but nothing was saved.

Do I have to create a job which does the actual processing? If yes, what are the methods for that?

Seems like this is the job being called from Carrierwave_Backgrounder: https://github.com/lardawge/carrierwave_backgrounder/blob/master/lib/backgrounder/workers/process_asset.rb

post.rb

class Post < ActiveRecord::Base
    mount_uploader :image, ImageUploader
    process_in_background :image

image_uploader.rb

class ImageUploader < CarrierWave::Uploader::Base

   include ::CarrierWave::Backgrounder::Delay
   include CarrierWave::RMagick
   include CarrierWave::MimeTypes

   storage :file

   process :resize_to_limit => [555, 2000]
   process :set_content_type

   version :facebook_share do
       process :resize_to_fill => [1200,627]
   end

carrierwave_backgrounder.rb

CarrierWave::Backgrounder.configure do |c|
   c.backend :resque, queue: :carrierwave
Foi útil?

Solução

Hahaha oh my god I feel so stupid ...

I realized I haven't used Resque in a while. I totally forgot to start my workers on the Queue. All the processing jobs just lined up waiting to get processed.

Damn!

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top