Class: Importo::ImportJob
- Inherits:
-
Object
- Object
- Importo::ImportJob
- Defined in:
- app/jobs/importo/import_job.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#perform(attributes, index, import_id) ⇒ Object
No options here, gets added from the adapter.
Class Method Details
.execute_row(attributes, index, import_id, last_attempt, bid) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/jobs/importo/import_job.rb', line 9 def self.execute_row(attributes, index, import_id, last_attempt, bid) attributes = JSON.load(attributes).deep_symbolize_keys if attributes.is_a?(String) import = Import.find(import_id) import.importer.process_data_row(attributes, index, last_attempt: last_attempt) # This should not be needed: # https://github.com/sidekiq/sidekiq/wiki/Batches#callbacks # # Between sidekiq and good job, there's a big difference: # - Sidekiq calls on_complete callback when all jobs ran at least once. # - GoodJob calls on_complete callback when all jobs are done (including retries). # i.e. this logic is only needed for sidekiq # return unless Importo.sidekiq? # batch = Importo::SidekiqBatchAdapter.find(bid) # if !import.completed? && import.can_complete? && batch.finished? # ImportJobCallback.perform_now(batch, import.id) # end end |
Instance Method Details
#perform(attributes, index, import_id) ⇒ Object
No options here, gets added from the adapter
5 6 7 |
# File 'app/jobs/importo/import_job.rb', line 5 def perform(attributes, index, import_id) self.class.execute_row(attributes, index, import_id, false, defined?(bid) ? bid : batch.id) end |