~singpolyma/whiplash-mboa

575c6a13195ba84d717d103ce5497270f8d83c65 — Stephen Paul Weber 1 year, 5 months ago 69bdf92
Only start periodic tasks if not in rake
1 files changed, 6 insertions(+), 4 deletions(-)

M config/initializers/shopify_app.rb
M config/initializers/shopify_app.rb => config/initializers/shopify_app.rb +6 -4
@@ 51,11 51,13 @@ Rails.application.config.after_initialize do

		ShopifyApp::WebhooksManager.add_registrations

		Shop.all.each do |shop|
			next unless shop.whiplash_api_key
		if Rake.application.top_level_tasks.empty?
			Shop.all.each do |shop|
				next unless shop.whiplash_api_key

			SyncAssignedOrdersJob.perform_later(shop, true)
			SyncWhiplashOrderStatusJob.perform_later(shop, true)
				SyncAssignedOrdersJob.perform_later(shop, true)
				SyncWhiplashOrderStatusJob.perform_later(shop, true)
			end
		end
	end
end