hasql-pool-1.0.1: Pool of connections for Hasql
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hasql.Pool.Config

Description

DSL for construction of configs.

Synopsis

Documentation

data Config Source #

Configufation for Hasql connection pool.

settings :: [Setting] -> Config Source #

Compile config from a list of settings. Latter settings override the preceding in cases of conflicts.

data Setting Source #

A single setting of a config.

size :: Int -> Setting Source #

Pool size.

3 by default.

acquisitionTimeout :: DiffTime -> Setting Source #

Connection acquisition timeout.

10 seconds by default.

agingTimeout :: DiffTime -> Setting Source #

Maximal connection lifetime.

Determines how long is available for reuse. After the timeout passes and an active session is finished the connection will be closed releasing a slot in the pool for a fresh connection to be established.

This is useful as a healthy measure for resetting the server-side caches.

1 day by default.

idlenessTimeout :: DiffTime -> Setting Source #

Maximal connection idle time.

How long to keep a connection open when it's not being used.

10 minutes by default.

staticConnectionSettings :: Settings -> Setting Source #

Connection string.

You can use settings to construct it.

By default it is:

"postgresql://postgres:postgres@localhost:5432/postgres"

dynamicConnectionSettings :: IO Settings -> Setting Source #

Action providing connection settings.

Gets used each time a connection gets established by the pool. This may be useful for some authorization models.

You can use settings to construct it.

By default it is:

pure "postgresql://postgres:postgres@localhost:5432/postgres"

observationHandler :: (Observation -> IO ()) -> Setting Source #

Observation handler.

Typically it's used for monitoring the state of the pool via metrics and logging.

If the provided action is not lightweight, it's recommended to use intermediate bufferring via channels like TBQueue to avoid occupying the pool management thread for too long. E.g., if the action is atomically . writeTBQueue yourQueue, then reading from it and processing can be done on a separate thread.

By default it is:

const (pure ())