If the main function of the example is modified to only start the server:
main :: IO ()
main = do
-- you could read this from some configuration file,
-- environment variable or somewhere else instead.
-- you will need to either change this connection string OR
-- set some environment variables (see
-- https://www.postgresql.org/docs/9.5/static/libpq-envars.html)
-- to point to a running PostgreSQL server for this example to work.
let connStr = ""
pool <- initConnectionPool connStr
runApp pool
the server will happily start without errors, but throw an exception each time a request is handled (because connStr is invalid).
Shouldn't createPool create a resource pool immediately -- and thus fail at this point -- rather than wait until withResource is called?
Hi there,
Thanks for creating this library!
I have a question about how to make the following
servant
example usingresource-pool
fail immediately when given an invalid connection string: https://haskell-servant.readthedocs.io/en/stable/cookbook/db-postgres-pool/PostgresPool.htmlIf the
main
function of the example is modified to only start the server:the server will happily start without errors, but throw an exception each time a request is handled (because
connStr
is invalid).Shouldn't
createPool
create a resource pool immediately -- and thus fail at this point -- rather than wait untilwithResource
is called?