Class: AmalyticsImportWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Job, Workers::StatusBroadcastable
Defined in:
app/workers/amalytics_import_worker.rb

Instance Attribute Summary

Attributes included from Workers::StatusBroadcastable

#broadcast_status_updates

Instance Method Summary collapse

Methods included from Workers::StatusBroadcastable::Overrides

#at, #store, #total

Instance Method Details

#perform(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/workers/amalytics_import_worker.rb', line 5

def perform(options = {})
  options = options.symbolize_keys
  upload_id = options[:upload_id]
  force = options[:force].to_b
  redirect_to = options[:redirect_to]
  upload = Upload.find(upload_id)
  file_path = upload.to_file
  importer = Amazon::ImportAmalyticsSnapshot.new(worker: self)
  res = importer.process(file_path:, force:)
  info_message = "Job Complete, #{res.items_result.size} rows processed"
  store redirect_to: redirect_to, info_message: info_message
end