hasql-pool 0.7.1.1 → 0.7.1.2
raw patch · 2 files changed
+14/−9 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- hasql-pool.cabal +1/−1
- library/Hasql/Pool.hs +13/−8
hasql-pool.cabal view
@@ -1,7 +1,7 @@ name: hasql-pool version:- 0.7.1.1+ 0.7.1.2 category: Hasql, Database, PostgreSQL synopsis:
library/Hasql/Pool.hs view
@@ -1,10 +1,11 @@ module Hasql.Pool- ( -- * --+ ( -- * Pool Pool, acquire, release, use,- -- * --++ -- * Errors UsageError (..), ) where@@ -29,6 +30,9 @@ } -- | Given the pool-size and connection settings create a connection-pool.+--+-- No connections actually get established by this function. It is delegated+-- to 'use'. acquire :: Int -> Connection.Settings -> IO Pool acquire poolSize connectionSettings = do Pool connectionSettings@@ -36,8 +40,7 @@ <*> newTVarIO poolSize <*> newTVarIO True --- |--- Release all the connections in the pool.+-- | Release all the connections in the pool. release :: Pool -> IO () release Pool {..} = do connections <- atomically $ do@@ -47,7 +50,7 @@ -- | Use a connection from the pool to run a session and return the connection -- to the pool, when finished.--- +-- -- Session failing with a 'Session.ClientError' get interpreted as a loss of -- connection. In such case the connection does not get returned to the pool -- and a slot gets freed up for a new connection to be established the next@@ -91,10 +94,12 @@ returnConn return $ Right res where- returnConn = do- atomically $ do+ returnConn =+ join . atomically $ do alive <- readTVar poolAlive- when alive $ writeTQueue poolConnectionQueue conn+ if alive+ then writeTQueue poolConnectionQueue conn $> return ()+ else return $ Connection.release conn -- | -- A union over the connection establishment error and the session error.