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])