~singpolyma/whiplash-mboa

f9b8a2e738bca84b4da3d42b73d11ed66115c581 — Stephen Paul Weber 1 year, 5 months ago 8bf41af
Only start scheduled jobs when not in rake
1 files changed, 9 insertions(+), 7 deletions(-)

M config/initializers/z_recurring_jobs.rb
M config/initializers/z_recurring_jobs.rb => config/initializers/z_recurring_jobs.rb +9 -7
@@ 1,13 1,15 @@
# frozen_string_literal: true

module WhiplashMboa
	class Application
		config.after_initialize do
			Shop.all.each do |shop|
				next unless shop.whiplash_api_key
if Rake.application.top_level_tasks.empty?
	module WhiplashMboa
		class Application
			config.after_initialize do
				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