Class: Vendors::VendorIntegrationTestsWorker

Inherits:
ApplicationWorker show all
Defined in:
app/workers/vendors/vendor_integration_tests_worker.rb

Instance Method Summary collapse

Methods inherited from ApplicationWorker

unlimited_retry

Instance Method Details

#perform(restaurant_ids = nil) ⇒ Object



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

def perform(restaurant_ids = nil)
  return unless Flipper.enabled?(:vendor_integration_tests)

  restaurant_ids = Array(restaurant_ids || AdminSetting.demo_restaurant_ids_for_vendor_integration_tests).uniq.compact

  if restaurant_ids.empty?
    APMErrorHandler.report("#{self.class}: No restaurant IDs found in admin settings.")
    return
  end

  restaurant_ids.each do |restaurant_id|
    generate_inventory_for(restaurant_id)
  end
end