New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
process_in_background option seems to ignore versions when process_<model>_upload=true #113
Comments
Couple things, What version of carrierwave and CB are you using? Have you tried passing it a local file? |
Here are the versions of carrierwave_* gems I'm using:
And yes, the same issue is reproduced with a local file, e.g.:
=> no thumbnail version on s3 |
To make sure |
Had a chance to look at this... I found a bug related to Rmagick but no issue with versions... Not sure where to go with this one. Strange... Can you reproduce in a clean app? |
I am also wondering if you're introducing a bug by having the model and attachment with the same name... Just a thought. |
I tried changing the column names from |
I have the same problem, I can not see the versions created on my s3 bucket. I can see only the original file. I'm using delayed_job. This is my uploader:
In my user.rb model
Please, how can I add versions with this marvelous gem. My versions is working fine with carrierwave. I'm using carrierwave (0.8.0). Thank you very much! |
@hyperrjas, are you starting up sidekiq correctly? It may not be processing the job. You need to specify the queue you set in the CB config when you start sidekiq or the jobs won't get processed. I am sure there is a closed ticket addressing this. There really should be a reminder in the documentation. |
Like this: #config/initializers/carrierwave_backgrounder.rb
CarrierWave::Backgrounder.configure do |c|
c.backend :sidekiq, queue: :bg_photos
end Start sidekiq with the following; sidekiq -c 3 -q bg_photos -q default @bantic and @hyperrjas |
@lardawge I was using it with carrierwave's default queue (called |
@lardawge I'm using delayed_job.
Is required use sidekiq to create versions?? Thank you very much! |
@bantic, An interesting discovery... if I set For now the workaround is to do things in the order below >> photo_model = Photo.new
>> photo_model.process_photo_upload = true
>> photo_model.remote_photo_url='http://media-cache-ec3.pinterest.com/192/a1/f1/6c/a1f16c832b0653b839f03547aa8787da.jpg' # random pinterest photo
>> photo_model.save! @hyperrjas, can you confirm this works or are you seeing another issue? |
@lardawge thank you for your response but I am not using sidekiq gem. I'm using delayed_job. I'm using mongodb as database with mongoid. I have not installed redis on my server and I can not install redis.
Is it neccessary use sidekiq to create versions? or is it possible create versions with delayed_job? Thank you very much! |
@hyperrjas, This issue is regarding overriding carrierwave_backgrounder with |
Not sure if it's related but I noticed that you're using the "mount_on" option in user.rb. I'm trying to work through an issue myself where specifying this option in the model causes carrierwave_backgrounder to not work correctly (for me at least). @bantic As a test, if you pull the mount_on: :avatar_filename option out of user.rb (and make sure the straight-up "avatar" field is in the DB for CW) does it start working? It did for me and now I'm just trying to figure out how to move forward since I need to keep the mount_on option in. |
@lardawge Can you paste an app example with delayed_job working and mongoid? @lukebergen I don't understand you mean. How is working your model with delelayed_job?. In https://github.com/jnicklas/carrierwave-mongoid there is a example with mount_on and for me is working fine without carrierwave_backgrounder:
Can you paste a example that is working with mongoid, delayed_job and carrierwave_backgrounder? Thank you! |
@hyperrjas Sorry, I was confusing your code with @bantic's. I'm using sidekiq, not delayed_job. I was just saying that for me, if I pull out the "mount_on" option from the "mount_uploader" call, carrierwave_background starts working for me. My code is something like this: app/models/attachment.rb
app/uploaders/file_uploader.rb
|
@lukebergen, What is not working correctly when you use mounted_on? |
@lardawge, It just never seems to send the job off to sidekiq. I'm digging into it now to try to get something more specific than that. |
Try passing your mounted on name as the arg to class Attachment
include Mongoid::Document
# the code as it is now fails to actually queue the sidekiq job.
# but if I comment out the ', mount_on: "file_filename"' part, it works.
mount_uploader :file, FileUploader, mount_on: "file_filename"
process_in_background :file_filename
...
end |
Yeah, that was one of the first things I tried. When I do that and run the following to test:
The line "att.file = File.open" seems to cause the processing to happen right there, it's like not specifying ":file" causes backgrounder to not link up with carrierwave and carrierwave goes and does it's own processing. Still digging. Edit: Also, when I do the 3 lines above with the model having "process_in_background :file_filename" the line "att.save" gives me a stacktrace with error "undefined method |
I figured that was a giant leap... can you open up a issue on this and add some details so we don't clutter this one. They aren't related as far as I can tell. |
Yup, created here: #130 If I figure it out I'll submit a PR |
I am attempting to test using carrierwave_backgrounder asynchronously, and every time I run it on the rails console, my thumbnail version does not get generated.
I'm storing the files on s3, and using sidekiq as my backgrounder queue.
Snippet of my
photo
model (photo.rb
), which uses a field of the same name (photo) to store the carrierwave file:photo_uploader.rb:
When I do the following on the rails console and then look at my s3 bucket, I only see one version, no thumbnail version:
If I do not set
process_photo_upload
to true and I run sidekiq in another terminal tab, the thumbnail does get generated properly.Is there something I'm doing wrong?
The text was updated successfully, but these errors were encountered: