hasql-pool 0.7.1 → 0.7.1.1
raw patch · 2 files changed
+22/−16 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 +21/−15
hasql-pool.cabal view
@@ -1,7 +1,7 @@ name: hasql-pool version:- 0.7.1+ 0.7.1.1 category: Hasql, Database, PostgreSQL synopsis:
library/Hasql/Pool.hs view
@@ -1,9 +1,11 @@ module Hasql.Pool- ( Pool,+ ( -- * --+ Pool, acquire, release,- UsageError (..), use,+ -- * --+ UsageError (..), ) where @@ -43,19 +45,13 @@ flushTQueue poolConnectionQueue forM_ connections Connection.release --- |--- A union over the connection establishment error and the session error.-data UsageError- = ConnectionUsageError Connection.ConnectionError- | SessionUsageError Session.QueryError- | PoolIsReleasedUsageError- deriving (Show, Eq)--instance Exception UsageError---- |--- Use a connection from the pool to run a session and--- return the connection to the pool, when finished.+-- | 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+-- time one is needed. The error still gets returned from this function. use :: Pool -> Session.Session a -> IO (Either UsageError a) use Pool {..} sess = join . atomically $ do@@ -99,3 +95,13 @@ atomically $ do alive <- readTVar poolAlive when alive $ writeTQueue poolConnectionQueue conn++-- |+-- A union over the connection establishment error and the session error.+data UsageError+ = ConnectionUsageError Connection.ConnectionError+ | SessionUsageError Session.QueryError+ | PoolIsReleasedUsageError+ deriving (Show, Eq)++instance Exception UsageError