From df7d71db321d41319b61dc04355f71eee593e759 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Tue, 14 Jun 2022 23:04:52 -0500 Subject: [PATCH] fix: Increase the db-pool-timeout to 1 hour --- CHANGELOG.md | 1 + src/PostgREST/CLI.hs | 2 +- src/PostgREST/Config.hs | 2 +- test/io/configs/expected/aliases.config | 2 +- test/io/configs/expected/boolean-numeric.config | 2 +- test/io/configs/expected/boolean-string.config | 2 +- test/io/configs/expected/defaults.config | 2 +- test/io/configs/expected/types.config | 2 +- 8 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f538f488..795dd3c1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - #2277, #2238, #1643, Prevent views from breaking one-to-many/many-to-one embeds when using column or FK as target - @steve-chavez + When using a column or FK as target for embedding(`/tbl?select=*,col-or-fk(*)`), only tables are now detected and views are not. + You can still use a column or an inferred FK on a view to embed a table(`/view?select=*,col-or-fk(*)`) + - #2317, Increase the `db-pool-timeout` to 1 hour to prevent frequent high connection latency - @steve-chavez ### Changed diff --git a/src/PostgREST/CLI.hs b/src/PostgREST/CLI.hs index 86efbc3d7..338549697 100644 --- a/src/PostgREST/CLI.hs +++ b/src/PostgREST/CLI.hs @@ -148,7 +148,7 @@ exampleConfigFile = |db-pool = 10 | |## Time to live, in seconds, for an idle database pool connection - |db-pool-timeout = 10 + |db-pool-timeout = 3600 | |## Stored proc to exec immediately after auth |# db-pre-request = "stored_proc_name" diff --git a/src/PostgREST/Config.hs b/src/PostgREST/Config.hs index a4344b3f1..d6e10a46c 100644 --- a/src/PostgREST/Config.hs +++ b/src/PostgREST/Config.hs @@ -214,7 +214,7 @@ parser optPath env dbSettings = <*> optWithAlias (optInt "db-max-rows") (optInt "max-rows") <*> (fromMaybe 10 <$> optInt "db-pool") - <*> (fromIntegral . fromMaybe 10 <$> optInt "db-pool-timeout") + <*> (fromIntegral . fromMaybe 3600 <$> optInt "db-pool-timeout") <*> (fmap toQi <$> optWithAlias (optString "db-pre-request") (optString "pre-request")) <*> (fromMaybe True <$> optBool "db-prepared-statements") diff --git a/test/io/configs/expected/aliases.config b/test/io/configs/expected/aliases.config index c03f098ef..ef5c3a5b7 100644 --- a/test/io/configs/expected/aliases.config +++ b/test/io/configs/expected/aliases.config @@ -4,7 +4,7 @@ db-channel-enabled = true db-extra-search-path = "public" db-max-rows = 1000 db-pool = 10 -db-pool-timeout = 10 +db-pool-timeout = 3600 db-pre-request = "check_alias" db-prepared-statements = true db-root-spec = "open_alias" diff --git a/test/io/configs/expected/boolean-numeric.config b/test/io/configs/expected/boolean-numeric.config index 3aa9dc6ae..cd6fc6e2e 100644 --- a/test/io/configs/expected/boolean-numeric.config +++ b/test/io/configs/expected/boolean-numeric.config @@ -4,7 +4,7 @@ db-channel-enabled = true db-extra-search-path = "public" db-max-rows = "" db-pool = 10 -db-pool-timeout = 10 +db-pool-timeout = 3600 db-pre-request = "" db-prepared-statements = false db-root-spec = "" diff --git a/test/io/configs/expected/boolean-string.config b/test/io/configs/expected/boolean-string.config index 3aa9dc6ae..cd6fc6e2e 100644 --- a/test/io/configs/expected/boolean-string.config +++ b/test/io/configs/expected/boolean-string.config @@ -4,7 +4,7 @@ db-channel-enabled = true db-extra-search-path = "public" db-max-rows = "" db-pool = 10 -db-pool-timeout = 10 +db-pool-timeout = 3600 db-pre-request = "" db-prepared-statements = false db-root-spec = "" diff --git a/test/io/configs/expected/defaults.config b/test/io/configs/expected/defaults.config index 8c1d89675..b34105bc9 100644 --- a/test/io/configs/expected/defaults.config +++ b/test/io/configs/expected/defaults.config @@ -4,7 +4,7 @@ db-channel-enabled = true db-extra-search-path = "public" db-max-rows = "" db-pool = 10 -db-pool-timeout = 10 +db-pool-timeout = 3600 db-pre-request = "" db-prepared-statements = true db-root-spec = "" diff --git a/test/io/configs/expected/types.config b/test/io/configs/expected/types.config index 3f2a2b4d2..5967f50cc 100644 --- a/test/io/configs/expected/types.config +++ b/test/io/configs/expected/types.config @@ -4,7 +4,7 @@ db-channel-enabled = true db-extra-search-path = "public" db-max-rows = "" db-pool = 10 -db-pool-timeout = 10 +db-pool-timeout = 3600 db-pre-request = "" db-prepared-statements = true db-root-spec = ""