Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable HASURA_GRAPHQL_PG_CONN_LIFETIME by default with a default of 1… #6191

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ The corresponding JWT config can be:
- server: allow configuring timeouts for actions (fixes #4966)
- server: fix bug which arised when renaming a table which had a manual relationship defined (close #4158)
- server: limit the length of event trigger names (close #5786)
- server: enable HASURA_GRAPHQL_PG_CONN_LIFETIME by default to reclaim memory
**NOTE:** If you have event triggers with names greater than 42 chars, then you should update their names to avoid running into Postgres identifier limit bug (#5786)
- server: fix issue with tracking custom functions that return `SETOF` materialized view (close #5294) (#5945)
- server: allow remote relationships with union, interface and enum type fields as well (fixes #5875) (#6080)
Expand Down
2 changes: 1 addition & 1 deletion server/cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ package graphql-engine
source-repository-package
type: git
location: https://github.com/hasura/pg-client-hs.git
tag: 5b112acaaae15664e2bc0817b1a17f44f04df69b
tag: 08b02fbb4e7c7e1ac44325ef1bd107725f59255f

source-repository-package
type: git
Expand Down
10 changes: 7 additions & 3 deletions server/src-lib/Hasura/Server/Init.hs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ mkServeOptions rso = do
-- hard throughput cap at 1000RPS when db queries take 50ms on average:
conns <- fromMaybe 50 <$> withEnv c (fst pgConnsEnv)
iTime <- fromMaybe 180 <$> withEnv i (fst pgTimeoutEnv)
connLifetime <- withEnv cl (fst pgConnLifetimeEnv)
connLifetime <- withEnv cl (fst pgConnLifetimeEnv) <&> \case
Nothing -> Just 120 -- Not set by user; use the default timeout
Just 0 -> Nothing -- user wants to disable PG_CONN_LIFETIME
Just n -> Just n -- user specified n seconds lifetime
allowPrepare <- fromMaybe True <$> withEnv p (fst pgUsePrepareEnv)
return $ Q.ConnParams stripes conns iTime allowPrepare connLifetime

Expand Down Expand Up @@ -379,8 +382,9 @@ pgTimeoutEnv =
pgConnLifetimeEnv :: (String, String)
pgConnLifetimeEnv =
( "HASURA_GRAPHQL_PG_CONN_LIFETIME"
, "Time from connection creation after which the connection should be destroyed and a new one "
<> "created. (default: none)"
, "Time from connection creation after which the connection should be destroyed and a new one "
<> "created. A value of 0 indicates we should never destroy an active connection. If 0 is "
<> "passed, memory from large query results may not be reclaimed. (default: 120 sec)"
)

pgUsePrepareEnv :: (String, String)
Expand Down