Class: AtlasEngine::AddressImporter::StreetBackfillJob

Inherits:
ResumableImportJob show all
Includes:
ImportLogHelper, LogHelper
Defined in:
app/jobs/atlas_engine/address_importer/street_backfill_job.rb

Constant Summary

Constants included from ImportLogHelper

ImportLogHelper::TEST_TIMESTAMP

Instance Method Summary collapse

Methods included from LogHelper

#log_error, #log_info, #log_warn

Methods included from ImportLogHelper

#import_log_error, #import_log_info

Methods inherited from ResumableImportJob

#country_import, #log_final_stats

Methods inherited from AtlasEngine::ApplicationJob

#argument

Instance Method Details

#build_enumerator(params, cursor:) ⇒ Object



10
11
12
# File 'app/jobs/atlas_engine/address_importer/street_backfill_job.rb', line 10

def build_enumerator(params, cursor:)
  enumerator_builder.build_times_enumerator(1, cursor: cursor)
end

#each_iteration(batch, params) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/jobs/atlas_engine/address_importer/street_backfill_job.rb', line 14

def each_iteration(batch, params)
  @country_code = params[:country_code]
  @locales = CountryProfile.for(@country_code).validation.index_locales
  return if @locales.nil? || @locales.size < 2

  import_log_info(
    country_import: country_import,
    message: "Backfilling street data for locales #{@locales}...",
  )

  ActiveRecord::Base.connection.execute(backfill_streets_sql)
end