jrgifford / delayed_paperclip

Process your Paperclip attachments in the background with delayed_job or Resque.
http://www.jstorimer.com/ruby/2010/01/30/delayed-paperclip.html
MIT License
402 stars 155 forks source link

Upload still being processed immediately #90

Closed pawel2105 closed 10 years ago

pawel2105 commented 10 years ago

In my development enivornment, uploads are still blocking and aren't being handled asynchronously. I've got redis and sidekiq started in development.

My stack:

delayed_paperclip (2.7.1) paperclip (4.1.1) sidekiq (3.1.0)

My model:

include Sidekiq::Worker
...
has_attached_file :photo
process_in_background :photo, processing_image_url: "path/to/img.png"

Log tailing shows processing happening synchronously:

[paperclip] saving /my-cool-photos/62/original/my_image.jpg
[AWS S3 200 6.778036 0 retries] put_object(:acl=>:public_read,:bucket_name=>"awesome_bucket",
                            :content_length=>267949,:content_type=>"image/jpeg",
                            :data=>Paperclip::UploadedFileAdapter: my_image.jpg,
                            :key=>"my-cool-photos/62/original/my_image.jpg")  

(0.8ms)  COMMIT
SQL (0.8ms)  UPDATE "people" SET photo_processing = 't' WHERE "people"."id" = 62
Redirected to http://mywebsite.dev/people/62
Completed 302 Found in 7021ms (ActiveRecord: 13.1ms)
Review Load (0.6ms)  SELECT "people".* FROM "people" WHERE "people"."id" = $1 LIMIT 1  [["id", 62]]
[paperclip] copying /my-cool-photos/62/original/my_image.jpg to 
        local file /var/folders/14/03xx7l1s2plg2r4_8zhzttjw0000gn/T/974f4cf28e66e597e205812d72a50e9520120531-27884-zairtv

In fact, when I kill my sidekiq process, the photo still uploads (I can see it in my S3 bucket) but photo_processing is set to true. Once sidekiq runs the job, the value just gets set to false.

pawel2105 commented 10 years ago

I misunderstood the point of this gem. All uploads are in fact handled synchronously, the processing is delayed.