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 (
29
29
postgresHostConfigEnvName = "POSTGRES_HOST"
30
30
postgresPortConfigEnvName = "POSTGRES_PORT"
31
31
postgresDbConfigEnvName = "POSTGRES_DB_NAME"
32
+ postgresMaxOpenConnsEnvName = "POSTGRES_MAX_OPEN_CONNS"
32
33
33
34
ramTableNameEnvName = "RAM_TABLE_NAME"
34
35
)
@@ -56,6 +57,7 @@ func NewDataProvider() (*DataProvider, error) {
56
57
hostConfig := env .NewStringConfig (postgresHostConfigEnvName , "" )
57
58
portConfig := env .NewInt64Config (postgresPortConfigEnvName , 0 )
58
59
dbConfig := env .NewStringConfig (postgresDbConfigEnvName , "" )
60
+ maxOpenConnsConfig := env .NewUint64Config (postgresMaxOpenConnsEnvName , 64 )
59
61
ramTableNameConfig := env .NewStringConfig (ramTableNameEnvName , "" )
60
62
61
63
db , err := pg .NewWithUsernameAndPassword (
@@ -69,6 +71,8 @@ func NewDataProvider() (*DataProvider, error) {
69
71
return nil , err
70
72
}
71
73
74
+ db .SetMaxOpenConns (int (maxOpenConnsConfig .Get (ctx )))
75
+
72
76
dp .Ram = postgres_ram_store .New (db , ramTableNameConfig .Get (ctx ))
73
77
default :
74
78
return nil , errors .Errorf ("invalid data storage type: %s" , selectedDataStorageType )
You can’t perform that action at this time.
0 commit comments