From 13db0970d6c212a2aebb72efed8206b74a77daee Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Tue, 3 Aug 2021 12:16:29 -0500 Subject: [PATCH] Set type map on *all* connections in pool --- sgx_jmp.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sgx_jmp.rb b/sgx_jmp.rb index fedc3164b52d0ad7e3ae8980edadec082ca86378..a62950ced94f75a39ab0f5ad6ae4f52919d2b00f 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -116,9 +116,10 @@ when_ready do BLATHER = self REDIS = EM::Hiredis.connect BTC_SELL_PRICES = BTCSellPrices.new(REDIS, CONFIG[:oxr_app_id]) - DB = PG::EM::ConnectionPool.new(dbname: "jmp") - DB.type_map_for_results = PG::BasicTypeMapForResults.new(DB) - DB.type_map_for_queries = PG::BasicTypeMapForQueries.new(DB) + DB = PG::EM::ConnectionPool.new(dbname: "jmp") do |conn| + conn.type_map_for_results = PG::BasicTypeMapForResults.new(conn) + conn.type_map_for_queries = PG::BasicTypeMapForQueries.new(conn) + end EM.add_periodic_timer(3600) do ping = Blather::Stanza::Iq::Ping.new(:get, CONFIG[:server][:host])