Class: Spree::Imports::ProcessRowsJob

Inherits:
BaseJob
  • Object
show all
Defined in:
app/jobs/spree/imports/process_rows_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(import_id) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'app/jobs/spree/imports/process_rows_job.rb', line 6

def perform(import_id)
  import = Spree::Import.find(import_id)

  # process all rows in sequential order
  import.rows.pending_and_failed.find_each(batch_size: 100) do |row|
    row.process!
  end

  # mark as complete
  import.complete!
end