File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ const (
2929 postgresHostConfigEnvName = "POSTGRES_HOST"
3030 postgresPortConfigEnvName = "POSTGRES_PORT"
3131 postgresDbConfigEnvName = "POSTGRES_DB_NAME"
32+ postgresMaxOpenConnsEnvName = "POSTGRES_MAX_OPEN_CONNS"
3233
3334 ramTableNameEnvName = "RAM_TABLE_NAME"
3435)
@@ -56,6 +57,7 @@ func NewDataProvider() (*DataProvider, error) {
5657 hostConfig := env .NewStringConfig (postgresHostConfigEnvName , "" )
5758 portConfig := env .NewInt64Config (postgresPortConfigEnvName , 0 )
5859 dbConfig := env .NewStringConfig (postgresDbConfigEnvName , "" )
60+ maxOpenConnsConfig := env .NewUint64Config (postgresMaxOpenConnsEnvName , 64 )
5961 ramTableNameConfig := env .NewStringConfig (ramTableNameEnvName , "" )
6062
6163 db , err := pg .NewWithUsernameAndPassword (
@@ -69,6 +71,8 @@ func NewDataProvider() (*DataProvider, error) {
6971 return nil , err
7072 }
7173
74+ db .SetMaxOpenConns (int (maxOpenConnsConfig .Get (ctx )))
75+
7276 dp .Ram = postgres_ram_store .New (db , ramTableNameConfig .Get (ctx ))
7377 default :
7478 return nil , errors .Errorf ("invalid data storage type: %s" , selectedDataStorageType )
You can’t perform that action at this time.
0 commit comments