You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then it prints the pool metrics and registry again, noting that the pool metrics still has 3 pools per origin while in the registry there are only 2 per origin
finch_name=Tobi.Tries_finch=Finch.start_link(name: finch_name,pools: %{default: [count: 3,pool_max_idle_time: to_timeout(second: 1),start_pool_metrics?: true]})urls=["http://www.google.com","https://www.screenversemedia.com/","http://hex.pm"]urls|>Enum.map(fnurl->Task.async(fn->Req.get!(url,finch: finch_name)end)end)|>Task.await_many()urls|>Enum.map(&(Finch.get_pool_status(finch_name,&1)))|>IO.inspect()urls|>Enum.map(&Finch.Request.parse_url/1)|>Enum.map(fn{s,h,p,_,_}->{{s,h,p},Registry.lookup(finch_name,{s,h,p})|>length()}end)|>IO.inspect()IO.puts("\n\n\nSLEEEEEPPPYYYY TTTTIIIIMMMMEEEEEEEE\n\n\n")# should kill the connections/poolsProcess.sleep(to_timeout(second: 5))urls|>Enum.map(&(Finch.get_pool_status(finch_name,&1)))|>IO.inspect()urls|>Enum.map(&Finch.Request.parse_url/1)|>Enum.map(fn{s,h,p,_,_}->{{s,h,p},Registry.lookup(finch_name,{s,h,p})|>length()}end)|>IO.inspect()
I suppose that in either the terminate/2 (Genserver)-callback (preferably, I suppose) or the NimblePools terminate_pool/2 callback the pool metrics of the terminating pool should be removed. Alternatively some "life check" process.
Should probably be happy to implement this, although I shouldn't make too many promises these days 馃槄
As usual, thanks a ton for all your work 馃挌
Problem
It seems to me that PoolMetrics aren't removed when the pool is terminated. That may make it seems like there are more pools than there actually are.
The following script demonstrates the problem and does the following:
pool_max_idle_timedoesn't shut down empty pools聽#311)The important output here is:
Solution
I suppose that in either the
terminate/2(Genserver)-callback (preferably, I suppose) or the NimblePoolsterminate_pool/2callback the pool metrics of the terminating pool should be removed. Alternatively some "life check" process.Should probably be happy to implement this, although I shouldn't make too many promises these days 馃槄