Handle already deleted photos gracefully in process photo job
This commit is contained in:
parent
499ff6e0f4
commit
d6f5368474
2 changed files with 8 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ module Workers
|
|||
photo.processed_image.store!(unprocessed_image)
|
||||
|
||||
photo.save!
|
||||
rescue ActiveRecord::RecordNotFound # Deleted before the job was run
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -63,4 +63,10 @@ describe Workers::ProcessPhoto do
|
|||
}.to_not raise_error
|
||||
|
||||
end
|
||||
|
||||
it 'handles already deleted photos gracefully' do
|
||||
expect {
|
||||
Workers::ProcessPhoto.new.perform(0)
|
||||
}.to_not raise_error
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue