lardawge / carrierwave_backgrounder

Offload CarrierWave's image processing and storage to a background process using ActiveJob or Sidekiq..
736 stars 402 forks source link

Fail to handle missing record when active job runs after the resource got delete #319

Closed nicolassocheleau closed 9 months ago

nicolassocheleau commented 10 months ago

If ProcessAsset is queued with ActiveJob but the resource is deleted before the job can start, it raises an exception.

Below is a testcase to highlight the issue (spec/integrations/process_in_background_spec.rb)

it 'skip the resource when not found' do
  admin.update(avatar: load_file('test-1.jpg'))
  expect(admin.avatar_processing).to be(true)
  admin.destroy
  expect do
    process_latest_sidekiq_job
  end.not_to raise_exception
end
lardawge commented 9 months ago

This is not something I will support given it is not a common use case. If there is something in your application that is causing this, you can follow the instructions in the readme and override the worker.