diff --git a/sgx_jmp.rb b/sgx_jmp.rb index 2db7f18b3ddffb06b22c41da5d39eab01d3fbb3b..1c71375ee72be3d2e77304165ac4489989bcfe68 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -169,6 +169,7 @@ when_ready do LOG.info "Ready" BLATHER = self REDIS = EM::Hiredis.connect + WEB_REGISTER_MANAGER = WebRegisterManager.new BTC_SELL_PRICES = BTCSellPrices.new(REDIS, CONFIG[:oxr_app_id]) DB = PG::EM::ConnectionPool.new(dbname: "jmp") do |conn| conn.type_map_for_results = PG::BasicTypeMapForResults.new(conn) @@ -305,7 +306,6 @@ COMMAND_MANAGER = SessionManager.new( timeout: 60 * 60, error_if: ->(s) { s.cancel? } ) -web_register_manager = WebRegisterManager.new disco_info to: Blather::JID.new(CONFIG[:component][:jid]) do |iq| reply = iq.reply @@ -392,7 +392,7 @@ Command.new( Command.execution.customer_repo.create(Command.execution.iq.from.stripped) }.then { |customer| Sentry.add_breadcrumb(Sentry::Breadcrumb.new(message: "Registration.for")) - Registration.for(customer, web_register_manager).then(&:write) + Registration.for(customer, WEB_REGISTER_MANAGER).then(&:write) }.then { StatsD.increment("registration.completed") }.catch_only(Command::Execution::FinalStanza) do |e| @@ -547,7 +547,7 @@ command :execute?, node: "web-register", sessionid: nil do |iq| cmd.form.fields = [var: "to", value: jid] cmd.form.type = "submit" }).then { |result| - web_register_manager.set(result.form.field("from")&.value.to_s.strip, tel) + WEB_REGISTER_MANAGER.set(result.form.field("from")&.value.to_s.strip, tel) }.then { BLATHER << iq.reply.tap { |reply| reply.status = :completed } }.catch { |e| panic(e, sentry_hub) }