re-Enable HASURA_GRAPHQL_PG_CONN_LIFETIME by default with a default o…

GitOrigin-RevId: 192fc4b80c6bf359334f013af87e20d7de9598ce
This commit is contained in:
Brandon Simmons 2021-04-12 22:55:06 -04:00 committed by hasura-bot
parent 52c2b0384e
commit 17dc201fef
2 changed files with 7 additions and 2 deletions

View File

@ -36,6 +36,7 @@ In the future, we will probably offer a way to explicitly choose which behaviour
(Add entries here in the order of: server, console, cli, docs, others)
- server: re-enable a default HASURA_GRAPHQL_PG_CONN_LIFETIME of 10min
- server: support for bigquery datasets
- console: add custom_column_names to track_table request with replaced invalid characters (#992)
- console: add details button to the success notification to see inserted row

View File

@ -257,7 +257,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)
poolTimeout <- withEnv pt (fst pgPoolTimeoutEnv)
return $ Q.ConnParams
@ -488,7 +491,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)"
)
pgPoolTimeoutEnv :: (String, String)