hasql-pool 0.8.0.6 → 0.8.0.7
raw patch · 3 files changed
+16/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +8/−0
- hasql-pool.cabal +1/−1
- library/Hasql/Pool.hs +7/−5
CHANGELOG.md view
@@ -1,3 +1,11 @@+# 0.8.0.7++Fix excessive connections during releases due to race conditions.++# 0.8.0.5++Fix connections not returning to the pool on exceptions.+ # 0.8.0.2 Fixed Windows build.
hasql-pool.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0 name: hasql-pool-version: 0.8.0.6+version: 0.8.0.7 category: Hasql, Database, PostgreSQL synopsis: Pool of connections for Hasql
library/Hasql/Pool.hs view
@@ -85,8 +85,9 @@ newReuse <- newTVar True writeTVar poolReuse newReuse conns <- flushTQueue poolConnectionQueue- modifyTVar' poolCapacity (+ (length conns))- return $ forM_ conns Connection.release+ return $ forM_ conns $ \conn -> do+ Connection.release conn+ atomically $ modifyTVar' poolCapacity succ -- | Use a connection from the pool to run a session and return the connection -- to the pool, when finished.@@ -132,6 +133,7 @@ onConn reuseVar conn = do sessRes <- catch (Session.run sess conn) $ \(err :: SomeException) -> do+ Connection.release conn atomically $ modifyTVar' poolCapacity succ throw err @@ -152,9 +154,9 @@ reuse <- readTVar reuseVar if reuse then writeTQueue poolConnectionQueue conn $> return ()- else do- modifyTVar' poolCapacity succ- return $ Connection.release conn+ else return $ do+ Connection.release conn+ atomically $ modifyTVar' poolCapacity succ -- | Union over all errors that 'use' can result in. data UsageError