mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Fix typo error and add concurrent_requests and concurrent_strategy in config
This commit is contained in:
@@ -51,7 +51,7 @@ const CGRATES_CFG_JSON = `
|
||||
"digest_separator": ",", // separator to use in replies containing data digests
|
||||
"digest_equal": ":", // equal symbol used in case of digests
|
||||
"rsr_separator": ";", // separator used within RSR fields
|
||||
"max_parralel_conns": 100, // the maximum number of connection used by the *parallel strategy
|
||||
"max_parallel_conns": 100, // the maximum number of connection used by the *parallel strategy
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ func TestDfGeneralJsonCfg(t *testing.T) {
|
||||
Digest_separator: utils.StringPointer(","),
|
||||
Digest_equal: utils.StringPointer(":"),
|
||||
Rsr_separator: utils.StringPointer(";"),
|
||||
Max_parralel_conns: utils.IntPointer(100),
|
||||
Max_parallel_conns: utils.IntPointer(100),
|
||||
}
|
||||
if gCfg, err := dfCgrJSONCfg.GeneralJsonCfg(); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -2695,34 +2695,36 @@ func TestGeneralCfg(t *testing.T) {
|
||||
"digest_separator": ",",
|
||||
"digest_equal": ":",
|
||||
"rsr_separator": ";",
|
||||
"max_parralel_conns": 100,
|
||||
"max_parallel_conns": 100,
|
||||
},
|
||||
}`
|
||||
eMap := map[string]interface{}{
|
||||
"node_id": "",
|
||||
"logger": "*syslog",
|
||||
"log_level": 6,
|
||||
"http_skip_tls_verify": false,
|
||||
"rounding_decimals": 5,
|
||||
"dbdata_encoding": "*msgpack",
|
||||
"tpexport_dir": "/var/spool/cgrates/tpe",
|
||||
"poster_attempts": 3,
|
||||
"failed_posts_dir": "/var/spool/cgrates/failed_posts",
|
||||
"failed_posts_ttl": "5s",
|
||||
"default_request_type": "*rated",
|
||||
"default_category": "call",
|
||||
"default_tenant": "cgrates.org",
|
||||
"default_timezone": "Local",
|
||||
"default_caching": "*reload",
|
||||
"connect_attempts": 5,
|
||||
"reconnects": -1,
|
||||
"connect_timeout": "1s",
|
||||
"reply_timeout": "2s",
|
||||
"locking_timeout": "0",
|
||||
"digest_separator": ",",
|
||||
"digest_equal": ":",
|
||||
"rsr_separator": ";",
|
||||
"max_parralel_conns": 100,
|
||||
"node_id": "",
|
||||
"logger": "*syslog",
|
||||
"log_level": 6,
|
||||
"http_skip_tls_verify": false,
|
||||
"rounding_decimals": 5,
|
||||
"dbdata_encoding": "*msgpack",
|
||||
"tpexport_dir": "/var/spool/cgrates/tpe",
|
||||
"poster_attempts": 3,
|
||||
"failed_posts_dir": "/var/spool/cgrates/failed_posts",
|
||||
"failed_posts_ttl": "5s",
|
||||
"default_request_type": "*rated",
|
||||
"default_category": "call",
|
||||
"default_tenant": "cgrates.org",
|
||||
"default_timezone": "Local",
|
||||
"default_caching": "*reload",
|
||||
"connect_attempts": 5,
|
||||
"reconnects": -1,
|
||||
"connect_timeout": "1s",
|
||||
"reply_timeout": "2s",
|
||||
"locking_timeout": "0",
|
||||
"digest_separator": ",",
|
||||
"digest_equal": ":",
|
||||
"rsr_separator": ";",
|
||||
"max_parallel_conns": 100,
|
||||
utils.ConcurrentRequestsCfg: 0,
|
||||
utils.ConcurrentStrategyCfg: utils.EmptyString,
|
||||
}
|
||||
if jsnCfg, err := NewCgrJsonCfgFromBytes([]byte(cfgJSONStr)); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -27,30 +27,32 @@ import (
|
||||
|
||||
// General config section
|
||||
type GeneralCfg struct {
|
||||
NodeID string // Identifier for this engine instance
|
||||
Logger string // dictates the way logs are displayed/stored
|
||||
LogLevel int // system wide log level, nothing higher than this will be logged
|
||||
HttpSkipTlsVerify bool // If enabled Http Client will accept any TLS certificate
|
||||
RoundingDecimals int // Number of decimals to round end prices at
|
||||
DBDataEncoding string // The encoding used to store object data in strings: <msgpack|json>
|
||||
TpExportPath string // Path towards export folder for offline Tariff Plans
|
||||
PosterAttempts int // Time to wait before writing the failed posts in a single file
|
||||
FailedPostsDir string // Directory path where we store failed http requests
|
||||
FailedPostsTTL time.Duration // Directory path where we store failed http requests
|
||||
DefaultReqType string // Use this request type if not defined on top
|
||||
DefaultCategory string // set default type of record
|
||||
DefaultTenant string // set default tenant
|
||||
DefaultTimezone string // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
|
||||
DefaultCaching string
|
||||
ConnectAttempts int // number of initial connection attempts before giving up
|
||||
Reconnects int // number of recconect attempts in case of connection lost <-1 for infinite | nb>
|
||||
ConnectTimeout time.Duration // timeout for RPC connection attempts
|
||||
ReplyTimeout time.Duration // timeout replies if not reaching back
|
||||
LockingTimeout time.Duration // locking mechanism timeout to avoid deadlocks
|
||||
DigestSeparator string //
|
||||
DigestEqual string //
|
||||
RSRSep string // separator used to split RSRParser (by default is used ";")
|
||||
MaxParralelConns int // the maximum number of connection used by the *parallel strategy
|
||||
NodeID string // Identifier for this engine instance
|
||||
Logger string // dictates the way logs are displayed/stored
|
||||
LogLevel int // system wide log level, nothing higher than this will be logged
|
||||
HttpSkipTlsVerify bool // If enabled Http Client will accept any TLS certificate
|
||||
RoundingDecimals int // Number of decimals to round end prices at
|
||||
DBDataEncoding string // The encoding used to store object data in strings: <msgpack|json>
|
||||
TpExportPath string // Path towards export folder for offline Tariff Plans
|
||||
PosterAttempts int // Time to wait before writing the failed posts in a single file
|
||||
FailedPostsDir string // Directory path where we store failed http requests
|
||||
FailedPostsTTL time.Duration // Directory path where we store failed http requests
|
||||
DefaultReqType string // Use this request type if not defined on top
|
||||
DefaultCategory string // set default type of record
|
||||
DefaultTenant string // set default tenant
|
||||
DefaultTimezone string // default timezone for timestamps where not specified <""|UTC|Local|$IANA_TZ_DB>
|
||||
DefaultCaching string
|
||||
ConnectAttempts int // number of initial connection attempts before giving up
|
||||
Reconnects int // number of recconect attempts in case of connection lost <-1 for infinite | nb>
|
||||
ConnectTimeout time.Duration // timeout for RPC connection attempts
|
||||
ReplyTimeout time.Duration // timeout replies if not reaching back
|
||||
LockingTimeout time.Duration // locking mechanism timeout to avoid deadlocks
|
||||
DigestSeparator string //
|
||||
DigestEqual string //
|
||||
RSRSep string // separator used to split RSRParser (by default is used ";")
|
||||
MaxParallelConns int // the maximum number of connection used by the *parallel strategy
|
||||
ConcurrentRequests int
|
||||
ConcurrentStrategy string
|
||||
}
|
||||
|
||||
//loadFromJsonCfg loads General config from JsonCfg
|
||||
@@ -136,8 +138,14 @@ func (gencfg *GeneralCfg) loadFromJsonCfg(jsnGeneralCfg *GeneralJsonCfg) (err er
|
||||
if jsnGeneralCfg.Rsr_separator != nil {
|
||||
gencfg.RSRSep = *jsnGeneralCfg.Rsr_separator
|
||||
}
|
||||
if jsnGeneralCfg.Max_parralel_conns != nil {
|
||||
gencfg.MaxParralelConns = *jsnGeneralCfg.Max_parralel_conns
|
||||
if jsnGeneralCfg.Max_parallel_conns != nil {
|
||||
gencfg.MaxParallelConns = *jsnGeneralCfg.Max_parallel_conns
|
||||
}
|
||||
if jsnGeneralCfg.Concurrent_requests != nil {
|
||||
gencfg.ConcurrentRequests = *jsnGeneralCfg.Concurrent_requests
|
||||
}
|
||||
if jsnGeneralCfg.Concurrent_strategy != nil {
|
||||
gencfg.ConcurrentStrategy = *jsnGeneralCfg.Concurrent_strategy
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -162,29 +170,31 @@ func (gencfg *GeneralCfg) AsMapInterface() map[string]interface{} {
|
||||
}
|
||||
|
||||
return map[string]interface{}{
|
||||
utils.NodeIDCfg: gencfg.NodeID,
|
||||
utils.LoggerCfg: gencfg.Logger,
|
||||
utils.LogLevelCfg: gencfg.LogLevel,
|
||||
utils.HttpSkipTlsVerifyCfg: gencfg.HttpSkipTlsVerify,
|
||||
utils.RoundingDecimalsCfg: gencfg.RoundingDecimals,
|
||||
utils.DBDataEncodingCfg: utils.Meta + gencfg.DBDataEncoding,
|
||||
utils.TpExportPathCfg: gencfg.TpExportPath,
|
||||
utils.PosterAttemptsCfg: gencfg.PosterAttempts,
|
||||
utils.FailedPostsDirCfg: gencfg.FailedPostsDir,
|
||||
utils.FailedPostsTTLCfg: failedPostsTTL,
|
||||
utils.DefaultReqTypeCfg: gencfg.DefaultReqType,
|
||||
utils.DefaultCategoryCfg: gencfg.DefaultCategory,
|
||||
utils.DefaultTenantCfg: gencfg.DefaultTenant,
|
||||
utils.DefaultTimezoneCfg: gencfg.DefaultTimezone,
|
||||
utils.DefaultCachingCfg: gencfg.DefaultCaching,
|
||||
utils.ConnectAttemptsCfg: gencfg.ConnectAttempts,
|
||||
utils.ReconnectsCfg: gencfg.Reconnects,
|
||||
utils.ConnectTimeoutCfg: connectTimeout,
|
||||
utils.ReplyTimeoutCfg: replyTimeout,
|
||||
utils.LockingTimeoutCfg: lockingTimeout,
|
||||
utils.DigestSeparatorCfg: gencfg.DigestSeparator,
|
||||
utils.DigestEqualCfg: gencfg.DigestEqual,
|
||||
utils.RSRSepCfg: gencfg.RSRSep,
|
||||
utils.MaxParralelConnsCfg: gencfg.MaxParralelConns,
|
||||
utils.NodeIDCfg: gencfg.NodeID,
|
||||
utils.LoggerCfg: gencfg.Logger,
|
||||
utils.LogLevelCfg: gencfg.LogLevel,
|
||||
utils.HttpSkipTlsVerifyCfg: gencfg.HttpSkipTlsVerify,
|
||||
utils.RoundingDecimalsCfg: gencfg.RoundingDecimals,
|
||||
utils.DBDataEncodingCfg: utils.Meta + gencfg.DBDataEncoding,
|
||||
utils.TpExportPathCfg: gencfg.TpExportPath,
|
||||
utils.PosterAttemptsCfg: gencfg.PosterAttempts,
|
||||
utils.FailedPostsDirCfg: gencfg.FailedPostsDir,
|
||||
utils.FailedPostsTTLCfg: failedPostsTTL,
|
||||
utils.DefaultReqTypeCfg: gencfg.DefaultReqType,
|
||||
utils.DefaultCategoryCfg: gencfg.DefaultCategory,
|
||||
utils.DefaultTenantCfg: gencfg.DefaultTenant,
|
||||
utils.DefaultTimezoneCfg: gencfg.DefaultTimezone,
|
||||
utils.DefaultCachingCfg: gencfg.DefaultCaching,
|
||||
utils.ConnectAttemptsCfg: gencfg.ConnectAttempts,
|
||||
utils.ReconnectsCfg: gencfg.Reconnects,
|
||||
utils.ConnectTimeoutCfg: connectTimeout,
|
||||
utils.ReplyTimeoutCfg: replyTimeout,
|
||||
utils.LockingTimeoutCfg: lockingTimeout,
|
||||
utils.DigestSeparatorCfg: gencfg.DigestSeparator,
|
||||
utils.DigestEqualCfg: gencfg.DigestEqual,
|
||||
utils.RSRSepCfg: gencfg.RSRSep,
|
||||
utils.MaxParallelConnsCfg: gencfg.MaxParallelConns,
|
||||
utils.ConcurrentRequestsCfg: gencfg.ConcurrentRequests,
|
||||
utils.ConcurrentStrategyCfg: gencfg.ConcurrentStrategy,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,34 +121,36 @@ func TestGeneralCfgAsMapInterface(t *testing.T) {
|
||||
"digest_separator": ",",
|
||||
"digest_equal": ":",
|
||||
"rsr_separator": ";",
|
||||
"max_parralel_conns": 100,
|
||||
"max_parallel_conns": 100,
|
||||
},
|
||||
}`
|
||||
eMap := map[string]interface{}{
|
||||
"node_id": "",
|
||||
"logger": "*syslog",
|
||||
"log_level": 6,
|
||||
"http_skip_tls_verify": false,
|
||||
"rounding_decimals": 5,
|
||||
"dbdata_encoding": "*msgpack",
|
||||
"tpexport_dir": "/var/spool/cgrates/tpe",
|
||||
"poster_attempts": 3,
|
||||
"failed_posts_dir": "/var/spool/cgrates/failed_posts",
|
||||
"failed_posts_ttl": "5s",
|
||||
"default_request_type": "*rated",
|
||||
"default_category": "call",
|
||||
"default_tenant": "cgrates.org",
|
||||
"default_timezone": "Local",
|
||||
"default_caching": "*reload",
|
||||
"connect_attempts": 5,
|
||||
"reconnects": -1,
|
||||
"connect_timeout": "1s",
|
||||
"reply_timeout": "2s",
|
||||
"locking_timeout": "0",
|
||||
"digest_separator": ",",
|
||||
"digest_equal": ":",
|
||||
"rsr_separator": ";",
|
||||
"max_parralel_conns": 100,
|
||||
"node_id": "",
|
||||
"logger": "*syslog",
|
||||
"log_level": 6,
|
||||
"http_skip_tls_verify": false,
|
||||
"rounding_decimals": 5,
|
||||
"dbdata_encoding": "*msgpack",
|
||||
"tpexport_dir": "/var/spool/cgrates/tpe",
|
||||
"poster_attempts": 3,
|
||||
"failed_posts_dir": "/var/spool/cgrates/failed_posts",
|
||||
"failed_posts_ttl": "5s",
|
||||
"default_request_type": "*rated",
|
||||
"default_category": "call",
|
||||
"default_tenant": "cgrates.org",
|
||||
"default_timezone": "Local",
|
||||
"default_caching": "*reload",
|
||||
"connect_attempts": 5,
|
||||
"reconnects": -1,
|
||||
"connect_timeout": "1s",
|
||||
"reply_timeout": "2s",
|
||||
"locking_timeout": "0",
|
||||
"digest_separator": ",",
|
||||
"digest_equal": ":",
|
||||
"rsr_separator": ";",
|
||||
"max_parallel_conns": 100,
|
||||
utils.ConcurrentRequestsCfg: 0,
|
||||
utils.ConcurrentStrategyCfg: utils.EmptyString,
|
||||
}
|
||||
if jsnCfg, err := NewCgrJsonCfgFromBytes([]byte(cfgJSONStr)); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -45,7 +45,9 @@ type GeneralJsonCfg struct {
|
||||
Digest_separator *string
|
||||
Digest_equal *string
|
||||
Rsr_separator *string
|
||||
Max_parralel_conns *int
|
||||
Max_parallel_conns *int
|
||||
Concurrent_requests *int
|
||||
Concurrent_strategy *string
|
||||
}
|
||||
|
||||
// Listen config section
|
||||
|
||||
@@ -103,7 +103,7 @@ func TestMfEnvReaderITRead(t *testing.T) {
|
||||
DigestSeparator: ",",
|
||||
DigestEqual: ":",
|
||||
RSRSep: ";",
|
||||
MaxParralelConns: 100,
|
||||
MaxParallelConns: 100,
|
||||
FailedPostsTTL: 5 * time.Second,
|
||||
}
|
||||
if !reflect.DeepEqual(expected, *mfCgrCfg.generalCfg) {
|
||||
|
||||
@@ -87,7 +87,7 @@ func (cM *ConnManager) getConn(connID string, biRPCClient rpcclient.ClientConnec
|
||||
cM.cfg.TlsCfg().ClientKey, cM.cfg.TlsCfg().ClientCerificate,
|
||||
cM.cfg.TlsCfg().CaCertificate, cM.cfg.GeneralCfg().ConnectAttempts,
|
||||
cM.cfg.GeneralCfg().Reconnects, cM.cfg.GeneralCfg().ConnectTimeout,
|
||||
cM.cfg.GeneralCfg().ReplyTimeout, rpcclient.InternalRPC, intChan, int64(cM.cfg.GeneralCfg().MaxParralelConns), false)
|
||||
cM.cfg.GeneralCfg().ReplyTimeout, rpcclient.InternalRPC, intChan, int64(cM.cfg.GeneralCfg().MaxParallelConns), false)
|
||||
} else if utils.SliceHasMember([]string{utils.EmptyString, utils.MetaGOB, utils.MetaJSON}, rpcConnCfg.Transport) {
|
||||
codec := rpcclient.GOBrpc
|
||||
if rpcConnCfg.Transport != "" {
|
||||
@@ -97,7 +97,7 @@ func (cM *ConnManager) getConn(connID string, biRPCClient rpcclient.ClientConnec
|
||||
cM.cfg.TlsCfg().ClientKey, cM.cfg.TlsCfg().ClientCerificate,
|
||||
cM.cfg.TlsCfg().CaCertificate, cM.cfg.GeneralCfg().ConnectAttempts,
|
||||
cM.cfg.GeneralCfg().Reconnects, cM.cfg.GeneralCfg().ConnectTimeout,
|
||||
cM.cfg.GeneralCfg().ReplyTimeout, codec, nil, int64(cM.cfg.GeneralCfg().MaxParralelConns), false)
|
||||
cM.cfg.GeneralCfg().ReplyTimeout, codec, nil, int64(cM.cfg.GeneralCfg().MaxParallelConns), false)
|
||||
} else {
|
||||
err = fmt.Errorf("Unsupported transport: <%s>", rpcConnCfg.Transport)
|
||||
}
|
||||
|
||||
@@ -1757,30 +1757,32 @@ var (
|
||||
|
||||
// GeneralCfg
|
||||
const (
|
||||
NodeIDCfg = "node_id"
|
||||
LoggerCfg = "logger"
|
||||
LogLevelCfg = "log_level"
|
||||
HttpSkipTlsVerifyCfg = "http_skip_tls_verify"
|
||||
RoundingDecimalsCfg = "rounding_decimals"
|
||||
DBDataEncodingCfg = "dbdata_encoding"
|
||||
TpExportPathCfg = "tpexport_dir"
|
||||
PosterAttemptsCfg = "poster_attempts"
|
||||
FailedPostsDirCfg = "failed_posts_dir"
|
||||
FailedPostsTTLCfg = "failed_posts_ttl"
|
||||
DefaultReqTypeCfg = "default_request_type"
|
||||
DefaultCategoryCfg = "default_category"
|
||||
DefaultTenantCfg = "default_tenant"
|
||||
DefaultTimezoneCfg = "default_timezone"
|
||||
DefaultCachingCfg = "default_caching"
|
||||
ConnectAttemptsCfg = "connect_attempts"
|
||||
ReconnectsCfg = "reconnects"
|
||||
ConnectTimeoutCfg = "connect_timeout"
|
||||
ReplyTimeoutCfg = "reply_timeout"
|
||||
LockingTimeoutCfg = "locking_timeout"
|
||||
DigestSeparatorCfg = "digest_separator"
|
||||
DigestEqualCfg = "digest_equal"
|
||||
RSRSepCfg = "rsr_separator"
|
||||
MaxParralelConnsCfg = "max_parralel_conns"
|
||||
NodeIDCfg = "node_id"
|
||||
LoggerCfg = "logger"
|
||||
LogLevelCfg = "log_level"
|
||||
HttpSkipTlsVerifyCfg = "http_skip_tls_verify"
|
||||
RoundingDecimalsCfg = "rounding_decimals"
|
||||
DBDataEncodingCfg = "dbdata_encoding"
|
||||
TpExportPathCfg = "tpexport_dir"
|
||||
PosterAttemptsCfg = "poster_attempts"
|
||||
FailedPostsDirCfg = "failed_posts_dir"
|
||||
FailedPostsTTLCfg = "failed_posts_ttl"
|
||||
DefaultReqTypeCfg = "default_request_type"
|
||||
DefaultCategoryCfg = "default_category"
|
||||
DefaultTenantCfg = "default_tenant"
|
||||
DefaultTimezoneCfg = "default_timezone"
|
||||
DefaultCachingCfg = "default_caching"
|
||||
ConnectAttemptsCfg = "connect_attempts"
|
||||
ReconnectsCfg = "reconnects"
|
||||
ConnectTimeoutCfg = "connect_timeout"
|
||||
ReplyTimeoutCfg = "reply_timeout"
|
||||
LockingTimeoutCfg = "locking_timeout"
|
||||
DigestSeparatorCfg = "digest_separator"
|
||||
DigestEqualCfg = "digest_equal"
|
||||
RSRSepCfg = "rsr_separator"
|
||||
MaxParallelConnsCfg = "max_parallel_conns"
|
||||
ConcurrentRequestsCfg = "concurrent_requests"
|
||||
ConcurrentStrategyCfg = "concurrent_strategy"
|
||||
)
|
||||
|
||||
// StorDbCfg
|
||||
|
||||
Reference in New Issue
Block a user