From adef6c1472e4a5a6086a1a024832c93b338b89c4 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 23 Mar 2022 14:33:49 -0500 Subject: [PATCH] Do not get CNAM during admin command Since this is used by the billing cronjob and hitting BW so much is too expensive. --- lib/empty_repo.rb | 5 +++++ sgx_jmp.rb | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 lib/empty_repo.rb diff --git a/lib/empty_repo.rb b/lib/empty_repo.rb new file mode 100644 index 0000000000000000000000000000000000000000..e559bbf680a86c91a303f8866a91a7f5ba2f18a1 --- /dev/null +++ b/lib/empty_repo.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +class EmptyRepo + def find(*); end +end diff --git a/sgx_jmp.rb b/sgx_jmp.rb index f99cda1f569566a1680667ac8bcfb62338f2af7f..7891cd95cce055283b63d25fb43ed68f9aeb3f35 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -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