~singpolyma/sgx-jmp

adef6c1472e4a5a6086a1a024832c93b338b89c4 — Stephen Paul Weber 2 years ago b5ae161
Do not get CNAM during admin command

Since this is used by the billing cronjob and hitting BW so much is too expensive.
2 files changed, 10 insertions(+), 1 deletions(-)

A lib/empty_repo.rb
M sgx_jmp.rb
A lib/empty_repo.rb => lib/empty_repo.rb +5 -0
@@ 0,0 1,5 @@
# frozen_string_literal: true

class EmptyRepo
	def find(*); end
end

M sgx_jmp.rb => sgx_jmp.rb +5 -1
@@ 82,6 82,7 @@ require_relative "lib/customer"
require_relative "lib/customer_info_form"
require_relative "lib/customer_repo"
require_relative "lib/electrum"
require_relative "lib/empty_repo"
require_relative "lib/expiring_lock"
require_relative "lib/em"
require_relative "lib/form_to_h"


@@ 725,7 726,10 @@ Command.new(
			reply.allowed_actions = [:next]
			reply.command << FormTemplate.render("customer_picker")
		}.then { |response|
			CustomerInfoForm.new.find_customer(response)
			CustomerInfoForm.new(CustomerRepo.new(
				sgx_repo: Bwmsgsv2Repo.new,
				bandwidth_tn_repo: EmptyRepo.new # No CNAM in admin
			)).find_customer(response)
		}.then do |target_customer|
			AdminCommand.new(target_customer).start
		end