Class: Bulkrax::DeleteJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/bulkrax/delete_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(entry, importer_run) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/jobs/bulkrax/delete_job.rb', line 7

def perform(entry, importer_run)
  user = importer_run.importer.user
  entry.factory.delete(user)

  # rubocop:disable Rails/SkipsModelValidations
  ImporterRun.increment_counter(:deleted_records, importer_run.id)
  ImporterRun.decrement_counter(:enqueued_records, importer_run.id)
  # rubocop:enable Rails/SkipsModelValidations
  entry.save!
  entry.importer.current_run = ImporterRun.find(importer_run.id)
  entry.importer.record_status
  entry.set_status_info("Deleted", ImporterRun.find(importer_run.id))
rescue => e
  entry.set_status_info(e)
  # this causes caught exception to be reraised
  raise
end