Skip to content

Commit 0eaf220

Browse files
Merge pull request #329 from scroll-tech/alpha
fix(db): fix `SetMaxOpenConns` (#328)
2 parents 7f6c219 + 24c7a63 commit 0eaf220

File tree

6 files changed

+13
-7
lines changed

6 files changed

+13
-7
lines changed

bridge/config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@
8282
},
8383
"db_config": {
8484
"driver_name": "postgres",
85-
"dsn": "postgres://admin:123456@localhost/test?sslmode=disable"
85+
"dsn": "postgres://admin:123456@localhost/test?sslmode=disable",
86+
"maxOpenNum": 200,
87+
"maxIdleNum": 20
8688
}
8789
}

common/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"runtime/debug"
66
)
77

8-
var tag = "alpha-v1.10"
8+
var tag = "alpha-v1.11"
99

1010
var commit = func() string {
1111
if info, ok := debug.ReadBuildInfo(); ok {

coordinator/config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
},
1313
"db_config": {
1414
"driver_name": "postgres",
15-
"dsn": "postgres://admin:123456@localhost/test?sslmode=disable"
15+
"dsn": "postgres://admin:123456@localhost/test?sslmode=disable",
16+
"maxOpenNum": 200,
17+
"maxIdleNum": 20
1618
},
1719
"l2_config": {
1820
"endpoint": "/var/lib/jenkins/workspace/SequencerPipeline/MyPrivateNetwork/geth.ipc"

database/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ type DBConfig struct {
1212
DSN string `json:"dsn"`
1313
DriverName string `json:"driver_name"`
1414

15-
MaxOpenNum int `json:"maxOpenNum" default:"200"`
16-
MaxIdleNum int `json:"maxIdleNum" default:"20"`
15+
MaxOpenNum int `json:"maxOpenNum"`
16+
MaxIdleNum int `json:"maxIdleNum"`
1717
}
1818

1919
// NewConfig returns a new instance of Config.

database/config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
22
"dsn": "postgres://postgres:123456@localhost:5444/test?sslmode=disable",
3-
"driver_name": "postgres"
3+
"driver_name": "postgres",
4+
"maxOpenNum": 200,
5+
"maxIdleNum": 20
46
}

database/orm_factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func NewOrmFactory(cfg *DBConfig) (OrmFactory, error) {
3838
return nil, err
3939
}
4040

41-
db.SetMaxIdleConns(cfg.MaxOpenNum)
41+
db.SetMaxOpenConns(cfg.MaxOpenNum)
4242
db.SetMaxIdleConns(cfg.MaxIdleNum)
4343
if err = db.Ping(); err != nil {
4444
return nil, err

0 commit comments

Comments
 (0)