Removed caches_conns from RalsCfg

This commit is contained in:
nickolasdaniel
2021-06-17 10:07:04 +03:00
committed by Dan Christian Bogos
parent a92bcc0ce1
commit 55d46cfa8a
5 changed files with 1 additions and 30 deletions

View File

@@ -236,7 +236,6 @@ const CGRATES_CFG_JSON = `
"enabled": false, // enable Rating/Accounting service: <true|false>
"thresholds_conns": [], // connections to ThresholdS for account/balance updates, empty to disable thresholds functionality: <""|*internal|$rpc_conns_id>
"stats_conns": [], // connections to StatS for account/balance updates, empty to disable stats functionality: <""|*internal|$rpc_conns_id>
"caches_conns":["*internal"], // connections to CacheS for account/balance updates
"rp_subject_prefix_matching": false, // enables prefix matching for the rating profile subject
"remove_expired":true, // enables automatic removal of expired balances
"max_computed_usage": { // do not compute usage higher than this, prevents memory overload

View File

@@ -352,7 +352,6 @@ func testCGRConfigReloadRALs(t *testing.T) {
RemoveExpired: true,
MaxComputedUsage: maxComp,
BalanceRatingSubject: blMap,
CacheSConns: []string{utils.MetaInternal + utils.InInFieldSep + utils.MetaCaches},
ThresholdSConns: []string{utils.MetaLocalHost},
StatSConns: []string{utils.MetaLocalHost},
MaxIncrements: 1000000,

View File

@@ -490,7 +490,6 @@ func TestDfRalsJsonCfg(t *testing.T) {
Enabled: utils.BoolPointer(false),
Thresholds_conns: &[]string{},
Stats_conns: &[]string{},
CacheS_conns: &[]string{utils.MetaInternal},
Rp_subject_prefix_matching: utils.BoolPointer(false),
Remove_expired: utils.BoolPointer(true),
Max_computed_usage: &map[string]string{

View File

@@ -20,7 +20,6 @@ package config
import (
"strconv"
"strings"
"time"
"github.com/cgrates/cgrates/utils"
@@ -31,7 +30,6 @@ type RalsCfg struct {
Enabled bool // start standalone server (no balancer)
ThresholdSConns []string // address where to reach ThresholdS config
StatSConns []string
CacheSConns []string
RpSubjectPrefixMatching bool // enables prefix matching for the rating profile subject
RemoveExpired bool
MaxComputedUsage map[string]time.Duration
@@ -69,17 +67,6 @@ func (ralsCfg *RalsCfg) loadFromJsonCfg(jsnRALsCfg *RalsJsonCfg) (err error) {
}
}
}
if jsnRALsCfg.CacheS_conns != nil {
ralsCfg.CacheSConns = make([]string, len(*jsnRALsCfg.CacheS_conns))
for idx, conn := range *jsnRALsCfg.CacheS_conns {
// if we have the connection internal we change the name so we can have internal rpc for each subsystem
if conn == utils.MetaInternal {
ralsCfg.CacheSConns[idx] = utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)
} else {
ralsCfg.CacheSConns[idx] = conn
}
}
}
if jsnRALsCfg.Rp_subject_prefix_matching != nil {
ralsCfg.RpSubjectPrefixMatching = *jsnRALsCfg.Rp_subject_prefix_matching
}
@@ -115,16 +102,6 @@ func (ralsCfg *RalsCfg) AsMapInterface() map[string]interface{} {
}
}
cacheSConns := make([]string, len(ralsCfg.CacheSConns))
for i, item := range ralsCfg.CacheSConns {
buf := utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)
if item == buf {
cacheSConns[i] = strings.ReplaceAll(item, ":*caches", utils.EmptyString)
} else {
cacheSConns[i] = item
}
}
balanceRating := make(map[string]interface{})
for key, item := range ralsCfg.BalanceRatingSubject {
balanceRating[key] = item
@@ -134,7 +111,6 @@ func (ralsCfg *RalsCfg) AsMapInterface() map[string]interface{} {
utils.EnabledCfg: ralsCfg.Enabled,
utils.ThresholdSConnsCfg: ralsCfg.ThresholdSConns,
utils.StatSConnsCfg: ralsCfg.StatSConns,
utils.CacheSConnsCfg: cacheSConns,
utils.RpSubjectPrefixMatchingCfg: ralsCfg.RpSubjectPrefixMatching,
utils.RemoveExpiredCfg: ralsCfg.RemoveExpired,
utils.MaxComputedUsageCfg: maxComputed,

View File

@@ -84,8 +84,7 @@ func TestRalsCfgAsMapInterface(t *testing.T) {
"rals": {
"enabled": false,
"thresholds_conns": [],
"stats_conns": [],
"caches_conns":["*internal"],
"stats_conns": [],
"rp_subject_prefix_matching": false,
"remove_expired":true,
"max_computed_usage": {
@@ -107,7 +106,6 @@ func TestRalsCfgAsMapInterface(t *testing.T) {
"enabled": false,
"thresholds_conns": []string{},
"stats_conns": []string{},
"caches_conns": []string{"*internal"},
"rp_subject_prefix_matching": false,
"remove_expired": true,
"max_computed_usage": map[string]interface{}{