summaryrefslogtreecommitdiff
path: root/app/workers/bulk_imports/entity_worker.rb
blob: 9b29ad8f326fa274784e84f22b3e5f6096e78275 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

module BulkImports
  class EntityWorker # rubocop:disable Scalability/IdempotentWorker
    include ApplicationWorker

    feature_category :importers

    sidekiq_options retry: false, dead: false

    worker_has_external_dependencies!

    def perform(entity_id)
      entity = BulkImports::Entity.with_status(:started).find_by_id(entity_id)

      if entity
        entity.update!(jid: jid)

        BulkImports::Importers::GroupImporter.new(entity).execute
      end
    end
  end
end