hasql-pool
Pool of connections for Hasql
https://github.com/nikita-volkov/hasql-pool
| LTS Haskell 24.65: | 1.3.0.5 |
| Stackage Nightly 2026-11-03: | 1.5.1.1 |
| Latest on Hackage: | 1.5.1.1 |
hasql-pool-1.5.1.1@sha256:c624f1e46afdc644e364aa3b5debc2c76bb06e7deb0182fb17a06f7343c54a1b,3016Module documentation for 1.5.1.1
Changes
v1.5.1.1
Fixes
- After the server closes an idle pooled connection (a Postgres restart,
pg_terminate_backend, a server-side idle timeout), the first session on it can fail withUnexpectedRowCountStatementErrorinstead of a connection error. Hasql maps the extra result that reports the closed connection to that error, and asingleRowstatement that returns two rows fails the same way on a healthy connection, so the error alone cannot justify a discard: the dead connection got returned to the pool and failed one more session before it was discarded, so after a database restart every pooled connection failed two sessions. Now, when a session fails with an error that does not require a discard,usealso checks the status that the adapter reports for the connection and discards it when it is marked bad.
v1.5.1.0
Fixes
- Fix pool capacity leak when
usegets interrupted during connection establishment, connection refresh, or an observation (#60) - Fix pool state corruption from throwing observation handlers; handlers
are now contained (see the updated
observationHandlerdocs) - Fix background reaper dying permanently from a failed connection release or observation
- Fix
releaseleaking flushed entries on failure - Fix waiters waiting forever on a garbage-collected pool
Added
reuseOrdersetting (#59): LIFO reuse lets the pool shrink to the connections the load needs and keeps caches warm; FIFO stays the default- One background timer for acquisition timeouts instead of one uncancelable timer per waiting request (#58)
Changed
- Connections are handed to waiting requests in arrival order; a request no longer takes a connection while others wait (#58)
v1.5.0.1
- Allow newer pqi.
v1.5.0.0
Breaking
- Migrate to
hasql-2, replacingpostgresql-libpqwith thepqiconnection-adapter interface.acquirenow takes aPqi.Adapteras its first argument; pick one from an adapter package such aspqi-ffiorpqi-native.
v1.4.2.3
Fixes
- Fix publishing.
v1.4.2.2
Fixes
- Fix pool capacity leak when
initSessionfails (#56) - Fix background reaper never passively evicting idle connections: it used the connection-lifetime timeout instead of the idleness timeout when checking for idle connections
v1.4.2.1
Fixes
- Discard pooled connections after driver errors (#55)
v1.4
- Migrated to
hasql-1.10 - Updated connection settings API to use monoid-based
Settingsinstead of list-based[Setting] - Updated error types to use
Hasql.Errorsmodule instead ofHasql.SessionandHasql.Connection - Changed session execution API from
Session.run session connectiontoConnection.use connection session - Error handling now uses
ConnectionSessionErrorfor connection-level issues instead ofClientError - Updated statement construction to use
Statement.preparableandStatement.unpreparableinstead of direct constructor - Hid the
Defaultsmodule from the public API
v1.3
- Adapt to the new settings model of
hasql-1.9
v1.2
- Migrated to
hasql-1.7 - Changed references to
QueryErrorin observations toSessionError
v1.1
ReadyForUseConnectionStatusgot extended with theConnectionReadyForUseReasondetails.initSessionsetting added.
v1
- Optional observability event stream added. Provides a flexible mechanism for monitoring the healthiness of the pool via logs and metrics.
- Configuration got isolated into a DSL, which will allow to provide new configurations without breaking backward compatibility.
v0.10.1
- Avoid releasing connections on exceptions thrown in session
v0.9
- Maximal lifetime added for connections. Allows to refresh the connections in time cleaning up the resources.
Breaking:
- The acquisition timeout is now non-optional.
- Moved to
DiffTimefor timeouts.
v0.8.0.7
Fix excessive connections during releases due to race conditions.
v0.8.0.5
Fix connections not returning to the pool on exceptions.
v0.8.0.2
Fixed Windows build.
v0.8
release became reusable. You can use it to destroy the whole pool (same as before), but now also you can use it to reset the connections.
Acquisition timeout added.
Breaking changes in API:
- Removed
PoolIsReleasedUsageError acquireextended with the acquisition timeout parameteracquireDynamicallyextended with the acquisition timeout parameter
v0.7.2
Added support for dynamic connection configuration (issue #11).
v0.7.1.2
Fixed connections not being released if they were in use during the call to release.
v0.7.1
Added Exception for UsageError.
v0.7
Simplified the implementation a lot by removing the notion of timeout.
Breaking:
- Removed the
Settingstype - Changed the signature of
acquire
v0.6
Moved away from “resource-pool” and fixed the handling of lost connections.
Breaking:
- Changed the suffix of
UsageErrorconstructors fromErrortoUsageError - Added
PoolIsReleasedUsageError