diff --git a/sgx_jmp.rb b/sgx_jmp.rb index bdbc26be7e8e866e392ed80e28608734a627d651..fa7c3593b8afaaa23f4c61254beb76ddc212ffd1 100644 --- a/sgx_jmp.rb +++ b/sgx_jmp.rb @@ -144,7 +144,6 @@ def panic(e, hub=nil) end EM.error_handler(&method(:panic)) -EM.threadpool_size = 10 require_relative "lib/blather_client" @client = BlatherClient.new @@ -221,7 +220,7 @@ when_ready do REDIS = EM::Hiredis.connect MEMCACHE = EM::P::Memcache.connect BTC_SELL_PRICES = BTCSellPrices.new(REDIS, CONFIG[:oxr_app_id]) - DB = Postgres.connect(dbname: "jmp", size: EM.threadpool_size + 2) + DB = Postgres.connect(dbname: "jmp", size: 5) TEL_SELECTIONS = TelSelections.new DB.hold do |conn| @@ -237,6 +236,7 @@ when_ready do load_plans_to_db! EM.add_periodic_timer(3600) do + DB.finish # Clear idle connections ping = Blather::Stanza::Iq::Ping.new(:get, CONFIG[:server][:host]) ping.from = CONFIG[:component][:jid] self << ping