Skip to content

Commit

Permalink
Set db connection pool max connections to aleast the value of getNumC…
Browse files Browse the repository at this point in the history
…apabilities
  • Loading branch information
mpscholten committed May 9, 2024
1 parent 45b0a2a commit 4ece29c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion IHP/FrameworkConfig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 4ece29c

Please sign in to comment.