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… #6190

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -121,6 +121,7 @@ This release contains the [PDV refactor (#4111)](https://github.com/hasura/graph
- server: accept only non-negative integers for batch size and refetch interval (close #5653) (#5759)
- 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
- server: Configurable websocket keep-alive interval. Add `--websocket-keepalive` command-line flag
and handle `HASURA_GRAPHQL_WEBSOCKET_KEEPALIVE` env variable (fix #3539)
**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)
Expand Down
2 changes: 1 addition & 1 deletion server/cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ package graphql-engine
source-repository-package
type: git
location: https://github.com/hasura/pg-client-hs.git
tag: 633a06ba9c1e6a561b0ad0d25951fcdf6dd054ca
tag: 08b02fbb4e7c7e1ac44325ef1bd107725f59255f

source-repository-package
type: git
Expand Down
8 changes: 6 additions & 2 deletions server/src-lib/Hasura/Server/Init.hs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,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 600 -- 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 @@ -393,7 +396,8 @@ 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)"
<> "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: 600 sec)"
)

pgUsePrepareEnv :: (String, String)
Expand Down