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
404 stars 155 forks source link

Handle Record Not Found Exceptions #205

Closed mikewagz closed 7 years ago

mikewagz commented 7 years ago

The queue often has failed jobs resulting from Record Not Found exceptions. Is there a way to gracefully handle these, either by canceling the job or rescuing the exception and allowing the job to succeed?

Couldn't find Photo with 'id'=62503 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.0/lib/active_record/relation/finder_methods.rb:357:in `raise_record_not_found_exception!' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.0/lib/active_record/relation/finder_methods.rb:477:in `find_one' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.0/lib/active_record/relation/finder_methods.rb:456:in `find_with_ids' 
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.0.0/lib/active_record/relation/finder_methods.rb:66:in `find' 
/app/vendor/bundle/ruby/2.3.0/gems/delayed_paperclip-3.0.1/lib/delayed_paperclip.rb:26:in `process_job' 
/app/vendor/bundle/ruby/2.3.0/gems/delayed_paperclip-3.0.1/lib/delayed_paperclip/process_job.rb:11:in `perform' 
/app/vendor/bundle/ruby/2.3.0/gems/activejob-5.0.0/lib/active_job/execution.rb:34:in `block in perform_now' 
...
mikewagz commented 7 years ago

This seems to happen when an object is deleted before the queue gets to the job.

jrgifford commented 7 years ago

Fix by https://github.com/jrgifford/delayed_paperclip/pull/206/