Class: SolidusBactracs::Api::SyncShipmentsJob

Inherits:
ApplicationJob
  • Object
show all
Defined in:
app/jobs/solidus_bactracs/api/sync_shipments_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(shipments) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/jobs/solidus_bactracs/api/sync_shipments_job.rb', line 8

def perform(shipments)
  shipments = select_shipments(shipments)
  return if shipments.empty?

  sync_shipments(shipments)

  # Verify bactracs sync
  shipments.each { |shipment| VerifyBactracsSyncWorker.perform_async(shipment.id) }

rescue RateLimitedError => e
  self.class.set(wait: e.retry_in).perform_later
rescue StandardError => e
  SolidusBactracs.config.error_handler.call(e, {})
end