Class: ElasticArSync::Elastic::Worker::IndexImportWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
lib/elastic_ar_sync/elastic/worker/index_import_worker.rb

Instance Method Summary collapse

Instance Method Details

#perform(klass, target_index, batch_size) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/elastic_ar_sync/elastic/worker/index_import_worker.rb', line 5

def perform(klass, target_index, batch_size)
  Rails.logger.debug "[elastic IndexImportWorker] start import #{target_index}"

  begin
    ElasticArSync::Elastic::Services::IndexHandler.new(Object.const_get(klass)).import_all_record(target_index, batch_size)
  rescue => e
    Rails.logger.debug "[elastic IndexImportWorker] error occur #{target_index} \n #{e.message}"
  end

  Rails.logger.debug "[elastic IndexImportWorker] finish import #{target_index}"
end