From 8e811fe62536a45b15e4333a0542d60dbbc74f43 Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Sat, 14 Oct 2023 19:53:43 +0200 Subject: feat(users/Profpatsch/whatcd-resolver): more otel traces Change-Id: I5094b64f202eeedb57510a25850bba2edd9ec36f Reviewed-on: https://cl.tvl.fyi/c/depot/+/9725 Reviewed-by: Profpatsch Autosubmit: Profpatsch Tested-by: BuildkiteCI --- .../Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'users/Profpatsch/my-prelude') diff --git a/users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs b/users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs index 55cedb336c32..ca78da47067f 100644 --- a/users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs +++ b/users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs @@ -194,7 +194,7 @@ data PoolingInfo = PoolingInfo unusedResourceOpenTime :: Seconds, -- | Max number of resources that can be -- in the Pool at any time - maxOpenResourcesPerStripe :: AtLeast 1 Int + maxOpenResourcesAcrossAllStripes :: AtLeast 1 Int } deriving stock (Generic, Eq, Show) deriving anyclass (FromJSON) @@ -218,12 +218,14 @@ initMonadPostgres logInfoFn connectInfo poolingInfo = do createPGConnPool :: IO (Pool Postgres.Connection) createPGConnPool = - Pool.createPool - poolCreateResource - poolfreeResource - poolingInfo.numberOfStripes.unAtLeast - (poolingInfo.unusedResourceOpenTime & secondsToNominalDiffTime) - (poolingInfo.maxOpenResourcesPerStripe.unAtLeast) + Pool.newPool $ + Pool.defaultPoolConfig + {- resource init action -} poolCreateResource + {- resource destruction -} poolfreeResource + ( poolingInfo.unusedResourceOpenTime.unSeconds + & fromIntegral @Natural @Double + ) + (poolingInfo.maxOpenResourcesAcrossAllStripes.unAtLeast) where poolCreateResource = Postgres.connect connectInfo poolfreeResource = Postgres.close -- cgit 1.4.1