about summary refs log tree commit diff
path: root/users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2023-10-14T17·53+0200
committerclbot <clbot@tvl.fyi>2023-10-14T18·01+0000
commit8e811fe62536a45b15e4333a0542d60dbbc74f43 (patch)
treeaf0a0dd8f215cf444d9e03234ecb32cf8b5361ae /users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs
parentcc040a5ad339c793d97b532bfc0a7965c02c5e23 (diff)
feat(users/Profpatsch/whatcd-resolver): more otel traces r/6809
Change-Id: I5094b64f202eeedb57510a25850bba2edd9ec36f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9725
Reviewed-by: Profpatsch <mail@profpatsch.de>
Autosubmit: Profpatsch <mail@profpatsch.de>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs')
-rw-r--r--users/Profpatsch/my-prelude/src/Postgres/MonadPostgres.hs16
1 files changed, 9 insertions, 7 deletions
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