From 4ece29c1606da6fec0d55a653e33087780d53670 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Thu, 9 May 2024 11:21:20 +0200 Subject: [PATCH] Set db connection pool max connections to aleast the value of getNumCapabilities --- IHP/FrameworkConfig.hs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/IHP/FrameworkConfig.hs b/IHP/FrameworkConfig.hs index b579a96bb..a2d895246 100644 --- a/IHP/FrameworkConfig.hs +++ b/IHP/FrameworkConfig.hs @@ -26,6 +26,8 @@ import IHP.EnvVar import qualified Prelude import qualified GHC.Stack as Stack +import qualified Control.Concurrent as Concurrent + newtype AppHostname = AppHostname Text newtype AppPort = AppPort Int newtype BaseUrl = BaseUrl Text @@ -154,7 +156,11 @@ ihpDefaultConfig = do case environment of Development -> 2 Production -> 60 - option $ DBPoolMaxConnections 20 + + -- poolMaxResources must not be smaller than numStripes + -- https://github.com/digitallyinduced/ihp/issues/1959 + numCapabilities <- configIO Concurrent.getNumCapabilities + option $ DBPoolMaxConnections (max numCapabilities 20) (AppPort port) <- findOption @AppPort