Class: SolidusShipstation::Api::ScheduleShipmentSyncsJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/solidus_shipstation/api/schedule_shipment_syncs_job.rb

Instance Method Summary collapse

Instance Method Details

#performObject



8
9
10
11
12
13
14
15
16
# File 'app/jobs/solidus_shipstation/api/schedule_shipment_syncs_job.rb', line 8

def perform
  shipments = SolidusShipstation::Shipment::PendingApiSyncQuery.apply(::Spree::Shipment.all)

  shipments.find_in_batches(batch_size: SolidusShipstation.config.api_batch_size) do |batch|
    SyncShipmentsJob.perform_later(batch.to_a)
  end
rescue StandardError => e
  SolidusShipstation.config.error_handler.call(e, {})
end