nikita-volkov / hasql-pool

A pool of connections for Hasql
http://hackage.haskell.org/package/hasql-pool
MIT License
17 stars 15 forks source link

ResourcePool: destroy resource on exception #8

Closed roberth closed 4 years ago

roberth commented 4 years ago

Before this change, IO-based exceptions in the session (act) caused the connection to "used" indefinitely; not returning capacity to the pool, eventually depleting the pool.

This PR is a conservative fix for the problem. I recommend to use withResource from the resource-pool package itself. It is more widely used and it does not have this problem. Additionally it unmasks exceptions for sessions. Do you think masking async exceptions is appropriate for sessions?

roberth commented 4 years ago

@nikita-volkov This has worked well for me in production. Do you think it can be merged?

nikita-volkov commented 4 years ago

Thanks! Sorry for missing the PR before

roberth commented 4 years ago

No problem. Thanks for merging!

domenkozar commented 4 years ago

@nikita-volkov any idea why the tests are failing?

nikita-volkov commented 4 years ago

Yup. It's the changes in the requirements of Travis. I've updated the config to fix that.