Changed opt for Event Exporter

This commit is contained in:
andronache
2021-05-10 10:11:17 +03:00
committed by Dan Christian Bogos
parent 83db7e77c8
commit 72b7618807
5 changed files with 6 additions and 7 deletions

View File

@@ -474,7 +474,7 @@ const CGRATES_CFG_JSON = `
// SQL
// "maxIdleConns": 0, // SQLMaxIdleConns
// "sqlMaxIdleConns": 0, // SQLMaxIdleConns
// "maxOpenConns": 0, // SQLMaxOpenConns
// "maxConnLifetime": 0, // SQLMaxConnLifetime

View File

@@ -397,7 +397,7 @@
"dbName": "exportedDatabase", // if dbName is not present "cgrates" will be used as default
"tableName": "expTable", // tableName is mandatory in opts for sql exporter
"sslmode": "disable",
"maxIdleConns": "10",
"sqlMaxIdleConns": "10",
"maxOpenConns": "100",
"maxConnLifetime": "0",
},
@@ -418,7 +418,7 @@
"dbName": "exportedDatabase",
"tableName": "expTable",
"sslmode": "disable",
"maxIdleConns": "10",
"sqlMaxIdleConns": "10",
"maxOpenConns": "100",
"maxConnLifetime": "0",
},

View File

@@ -107,7 +107,7 @@ func openDB(cgrCfg *config.CGRConfig, cfgIdx int, dialect gorm.Dialector) (db *g
return
}
if iface, has := cgrCfg.EEsCfg().Exporters[cfgIdx].Opts[utils.SQLMaxIdleConns]; has {
if iface, has := cgrCfg.EEsCfg().Exporters[cfgIdx].Opts[utils.SQLMaxIdleConnsCfg]; has {
val, err := utils.IfaceAsTInt64(iface)
if err != nil {
return nil, nil, err

View File

@@ -231,7 +231,7 @@ func testSqlEeVerifyExportedEvent2(t *testing.T) {
func TestOpenDB1(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
cgrCfg.EEsCfg().Exporters[0].Opts[utils.SQLMaxIdleConns] = 2
cgrCfg.EEsCfg().Exporters[0].Opts[utils.SQLMaxIdleConnsCfg] = 2
dialect := mysql.Open(fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8&loc=Local&parseTime=true&sql_mode='ALLOW_INVALID_DATES'",
"cgrates", "CGRateS.org", "127.0.0.1", "3306", "cgrates"))
_, _, err := openDB(cgrCfg, 0, dialect)
@@ -242,7 +242,7 @@ func TestOpenDB1(t *testing.T) {
func TestOpenDB1Err(t *testing.T) {
cgrCfg := config.NewDefaultCGRConfig()
cgrCfg.EEsCfg().Exporters[0].Opts[utils.SQLMaxIdleConns] = "test"
cgrCfg.EEsCfg().Exporters[0].Opts[utils.SQLMaxIdleConnsCfg] = "test"
dialect := mysql.Open(fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8&loc=Local&parseTime=true&sql_mode='ALLOW_INVALID_DATES'",
"cgrates", "CGRateS.org", "127.0.0.1", "3306", "cgrates"))
_, _, err := openDB(cgrCfg, 0, dialect)

View File

@@ -2466,7 +2466,6 @@ const (
ElsVersionType = "elsVersionType"
ElsWaitForActiveShards = "elsWaitForActiveShards"
// SQLEe options
SQLMaxIdleConns = "maxIdleConns"
SQLMaxOpenConns = "maxOpenConns"
SQLMaxConnLifetime = "maxConnLifetime"