Closed robx closed 1 year ago
hasql-pool uses this pattern to discard connections:
hasql-pool
join . atomically $ do -- stuff modifyTVar' poolCapacity succ return $ Connection.release conn
This means (unless I'm missing something?) that it's quite possible to run into a sequence of actions
Between 2 and 3 there are more "physical" connections than the pool limit, if we were at the limit before.
This seems like something we'd want to guarantee can't happen, right?
A possible solution should be to change that fragment to
join . atomically $ do -- stuff return $ do Connection.release conn atomically $ modifyTVar' poolCapacity succ
Yep. Great catch of an undiscovered bug :)
hasql-pool
uses this pattern to discard connections:This means (unless I'm missing something?) that it's quite possible to run into a sequence of actions
Between 2 and 3 there are more "physical" connections than the pool limit, if we were at the limit before.
This seems like something we'd want to guarantee can't happen, right?
A possible solution should be to change that fragment to