Set type map on *all* connections in pool

Stephen Paul Weber created

Change summary

sgx_jmp.rb | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

Detailed changes

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