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

ignore objects with attachments deleted before processing #101

Closed riffraff closed 9 years ago

riffraff commented 10 years ago

I am not sure if you want to consider this, but there is an edge case in which an object with an attachment can be deleted before the background job is processed.
The code in #process_jobwill then error out because instance_klass.constantize.unscoped.find(instance_id) will not find the given record.

Depending on the queue implementation this may mean the job is rescheduled a ton of times even if it will always fail, or, in my specific case, it means it makes some of my tests fail :)

IMVHO it makes sense to trap ActiveRecord::NotFound and consider the job completed.

ScotterC commented 9 years ago

Solved by https://github.com/jrgifford/delayed_paperclip/pull/152