Class: Bulkrax::ImportWorkCollectionJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/bulkrax/import_work_collection_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(*args) ⇒ Object

rubocop:disable Rails/SkipsModelValidations



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

def perform(*args)
  entry = Entry.find(args[0])
  begin
    entry.build
    entry.save
    add_user_to_permission_template!(entry)
    ImporterRun.find(args[1]).increment!(:processed_collections)
    ImporterRun.find(args[1]).decrement!(:enqueued_records)
  rescue => e
    ImporterRun.find(args[1]).increment!(:failed_collections)
    ImporterRun.find(args[1]).decrement!(:enqueued_records)
    raise e
  end
end