packages feed

hasql-resource-pool 1.9.1.2 → 1.9.1.3

raw patch · 3 files changed

+17/−12 lines, 3 filesdep ~resource-pool

Dependency ranges changed: resource-pool

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+# 1.9.1.3++* Support for `resource-pool-0.5.0.0`++ # 1.9.1.2  * Breaking change: the API is made compatible with `hasql-1.9.1.2`
hasql-resource-pool.cabal view
@@ -1,7 +1,7 @@ cabal-version:      3.6  name:               hasql-resource-pool-version:            1.9.1.2+version:            1.9.1.3 category:           Hasql, Database, PostgreSQL synopsis:           A pool of connections for Hasql based on resource-pool. description:        This package was originally derived from hasql-pool v0.5.2.2. It continues using `resource-pool` for its pool implementation.@@ -73,7 +73,7 @@         Hasql.Pool.Prelude     build-depends:         -- resources:-        ,   resource-pool >= 0.4.0.0 && < 1+        ,   resource-pool >= 0.5.0.0 && < 1         -- database:         ,   hasql         >= 1.9.1.2 && < 2         -- data:
library/Hasql/Pool.hs view
@@ -19,10 +19,10 @@ ) where -import qualified    Data.Pool           as ResourcePool-import qualified    Data.Text           as T-import qualified    Data.Pool.Internal  as Unstable-import              System.Clock        (Clock(Monotonic), diffTimeSpec, getTime, toNanoSecs)+import qualified    Data.Pool                                   as ResourcePool+import qualified    Data.Text                                   as T+import qualified    Data.Pool.Internal                          as Unstable+import              System.Clock                                (Clock(Monotonic), diffTimeSpec, getTime, toNanoSecs)  import              Hasql.Pool.Prelude import qualified    Hasql.Connection@@ -30,7 +30,7 @@ import qualified    Hasql.Connection.Setting.Connection import qualified    Hasql.Connection.Setting.Connection.Param import qualified    Hasql.Session-import              Hasql.Pool.Observer (Observed(..), ObserverAction)+import              Hasql.Pool.Observer                         (Observed(..), ObserverAction)   -- |@@ -212,14 +212,14 @@      currentlyAvailablePerStripe = traverse id peekAvailable     peekAvailable               = (fmap stripeAvailability) <$> allStripes    -- array of IO Int-    stripeAvailability ms       = maybe quotaPerStripe Unstable.available ms  -- if the stripe ref is uninitialised, count the default availability-    allStripes                  = peekStripe <$> Unstable.localPools pool     -- array of IO Maybe-    peekStripe                  = tryReadMVar . Unstable.stripeVar+    stripeAvailability ms       = Unstable.available ms                       -- stripe is always initialized with value, as it's from TVar+    allStripes                  = peekStripe <$> Unstable.localPools pool     -- array of IO vals+    peekStripe                  = readTVarIO . Unstable.stripeVar      -- data from the pool-    quotaPerStripe              = maxResources `quotCeil` numStripes-    numStripes                  = length $ Unstable.localPools pool  -- can be 'sizeofSmallArray' but requires 'primitive' as dependency     maxResources                = Unstable.poolMaxResources . Unstable.poolConfig $ pool+    _quotaPerStripe             = maxResources `quotCeil` _numStripes+    _numStripes                 = length $ Unstable.localPools pool  -- can be 'sizeofSmallArray' but requires 'primitive' as dependency     quotCeil x y                = let (z, r) = x `quotRem` y in if r == 0 then z else z + 1  -- copied from 'Data.Pool.Internal'