about summary refs log tree commit diff
path: root/users/Profpatsch/my-prelude
diff options
context:
space:
mode:
Diffstat (limited to 'users/Profpatsch/my-prelude')
-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