From 1829078b1b5b86fe9088ba9073802c68165487f8 Mon Sep 17 00:00:00 2001 From: Alexandre Esteves Date: Sat, 4 May 2024 01:47:50 +0100 Subject: [PATCH] Fix deprecation warning --- .../src/Gargoyle/PostgreSQL/Connect.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gargoyle-postgresql-connect/src/Gargoyle/PostgreSQL/Connect.hs b/gargoyle-postgresql-connect/src/Gargoyle/PostgreSQL/Connect.hs index 718e1fc..56809dc 100644 --- a/gargoyle-postgresql-connect/src/Gargoyle/PostgreSQL/Connect.hs +++ b/gargoyle-postgresql-connect/src/Gargoyle/PostgreSQL/Connect.hs @@ -1,9 +1,10 @@ +{-# LANGUAGE TypeApplications #-} module Gargoyle.PostgreSQL.Connect (withDb, withDb', openDb) where import Control.Monad ((>=>)) import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as C8 -import Data.Pool (Pool, createPool) +import Data.Pool (Pool, defaultPoolConfig, newPool, setNumStripes) import Database.PostgreSQL.Simple (Connection, close, connectPostgreSQL) import Gargoyle (withGargoyle) import Gargoyle.PostgreSQL.Nix (postgresNix) @@ -17,7 +18,7 @@ withDb dbPath f = either error pure =<< withDb' dbPath (openDb >=> f) -- | Convert a connection string into a connection 'Pool'. openDb :: ByteString -> IO (Pool Connection) -openDb dbUri = createPool (connectPostgreSQL dbUri) close 1 5 20 +openDb dbUri = newPool $ setNumStripes (Just 1) $ defaultPoolConfig (connectPostgreSQL dbUri) close (realToFrac @Int 5) 20 -- | Connects to a database using information at the given filepath. -- The given filepath can be either a folder (for a local db)