Remove attributes_conns from RALs

This commit is contained in:
TeoV
2018-07-24 07:16:54 -04:00
committed by Dan Christian Bogos
parent dea8810abc
commit 67a0cf081a
10 changed files with 4 additions and 48 deletions

View File

@@ -1062,7 +1062,6 @@ func startRpc(server *utils.Server, internalRaterChan,
)
}
}
}
func writePid() {
@@ -1231,8 +1230,7 @@ func main() {
if cfg.RALsEnabled {
go startRater(internalRaterChan, cacheS, internalThresholdSChan,
internalCdrStatSChan, internalStatSChan,
internalPubSubSChan, internalAttributeSChan,
internalUserSChan, internalAliaseSChan,
internalPubSubSChan, internalUserSChan, internalAliaseSChan,
srvManager, server, dm, loadDb, cdrDb, &stopHandled, exitChan)
}

View File

@@ -32,7 +32,7 @@ import (
// Starts rater and reports on chan
func startRater(internalRaterChan chan rpcclient.RpcClientConnection, cacheS *engine.CacheS,
internalThdSChan, internalCdrStatSChan, internalStatSChan, internalPubSubSChan,
internalAttributeSChan, internalUserSChan, internalAliaseSChan chan rpcclient.RpcClientConnection,
internalUserSChan, internalAliaseSChan chan rpcclient.RpcClientConnection,
serviceManager *servmanager.ServiceManager, server *utils.Server,
dm *engine.DataManager, loadDb engine.LoadStorage, cdrDb engine.CdrStorage, stopHandled *bool, exitChan chan bool) {
var waitTasks []chan struct{}
@@ -126,25 +126,6 @@ func startRater(internalRaterChan chan rpcclient.RpcClientConnection, cacheS *en
}()
}
var attrS *rpcclient.RpcClientPool
if len(cfg.RALsAttributeSConns) != 0 { // Connections to AttributeS
attrsTaskChan := make(chan struct{})
waitTasks = append(waitTasks, attrsTaskChan)
go func() {
defer close(attrsTaskChan)
var err error
attrS, err = engine.NewRPCPool(rpcclient.POOL_FIRST, cfg.TLSClientKey, cfg.TLSClientCerificate, cfg.ConnectAttempts,
cfg.Reconnects, cfg.ConnectTimeout, cfg.ReplyTimeout,
cfg.RALsAttributeSConns, internalAttributeSChan, cfg.InternalTtl)
if err != nil {
utils.Logger.Crit(fmt.Sprintf("<RALs> Could not connect to %s, error: %s",
utils.AttributeS, err.Error()))
exitChan <- true
return
}
}()
}
if len(cfg.RALsAliasSConns) != 0 { // Connection to AliasService
aliasesTaskChan := make(chan struct{})
waitTasks = append(waitTasks, aliasesTaskChan)
@@ -192,9 +173,6 @@ func startRater(internalRaterChan chan rpcclient.RpcClientConnection, cacheS *en
if thdS != nil {
engine.SetThresholdS(thdS) // temporary architectural fix until we will have separate AccountS
}
if attrS != nil {
responder.AttributeS = attrS
}
if cdrStats != nil { // ToDo: Fix here properly the init of stats
responder.CdrStats = cdrStats
apierRpcV1.CdrStatsSrv = cdrStats

View File

@@ -315,7 +315,6 @@ type CGRConfig struct {
RALsCDRStatSConns []*HaPoolConfig // address where to reach the cdrstats service. Empty to disable stats gathering <""|internal|x.y.z.y:1234>
RALsStatSConns []*HaPoolConfig
RALsPubSubSConns []*HaPoolConfig
RALsAttributeSConns []*HaPoolConfig
RALsUserSConns []*HaPoolConfig
RALsAliasSConns []*HaPoolConfig
RpSubjectPrefixMatching bool // enables prefix matching for the rating profile subject
@@ -399,12 +398,6 @@ func (self *CGRConfig) checkConfigSanity() error {
return errors.New("Alias server not enabled but requested by RALs component.")
}
}
for _, connCfg := range self.RALsAttributeSConns {
if connCfg.Address == utils.MetaInternal && !self.attributeSCfg.Enabled {
return errors.New("Attribute service not enabled but requested by RALs component.")
}
}
for _, connCfg := range self.RALsUserSConns {
if connCfg.Address == utils.MetaInternal && !self.UserServerEnabled {
return errors.New("User service not enabled but requested by RALs component.")
@@ -1142,14 +1135,6 @@ func (self *CGRConfig) loadFromJsonCfg(jsnCfg *CgrJsonCfg) (err error) {
self.RALsPubSubSConns[idx].loadFromJsonCfg(jsnHaCfg)
}
}
if jsnRALsCfg.Attributes_conns != nil {
self.RALsAttributeSConns = make([]*HaPoolConfig, len(*jsnRALsCfg.Attributes_conns))
for idx, jsnHaCfg := range *jsnRALsCfg.Attributes_conns {
self.RALsAttributeSConns[idx] = NewDfltHaPoolConfig()
self.RALsAttributeSConns[idx].loadFromJsonCfg(jsnHaCfg)
}
}
if jsnRALsCfg.Aliases_conns != nil {
self.RALsAliasSConns = make([]*HaPoolConfig, len(*jsnRALsCfg.Aliases_conns))
for idx, jsnHaCfg := range *jsnRALsCfg.Aliases_conns {

View File

@@ -161,7 +161,6 @@ const CGRATES_CFG_JSON = `
"cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234>
"stats_conns": [], // address where to reach the stat service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234>
"pubsubs_conns": [], // address where to reach the pubusb service, empty to disable pubsub functionality: <""|*internal|x.y.z.y:1234>
"attributes_conns": [], // address where to reach the attribute service, empty to disable attributes functionality: <""|*internal|x.y.z.y:1234>
"users_conns": [], // address where to reach the user service, empty to disable user profile functionality: <""|*internal|x.y.z.y:1234>
"aliases_conns": [], // address where to reach the aliases service, empty to disable aliases functionality: <""|*internal|x.y.z.y:1234>
"rp_subject_prefix_matching": false, // enables prefix matching for the rating profile subject

View File

@@ -244,7 +244,6 @@ func TestDfRalsJsonCfg(t *testing.T) {
Cdrstats_conns: &[]*HaPoolJsonCfg{},
Stats_conns: &[]*HaPoolJsonCfg{},
Pubsubs_conns: &[]*HaPoolJsonCfg{},
Attributes_conns: &[]*HaPoolJsonCfg{},
Users_conns: &[]*HaPoolJsonCfg{},
Aliases_conns: &[]*HaPoolJsonCfg{},
Rp_subject_prefix_matching: utils.BoolPointer(false),

View File

@@ -453,9 +453,6 @@ func TestCgrCfgJSONDefaultsRALs(t *testing.T) {
if !reflect.DeepEqual(cgrCfg.RALsPubSubSConns, eHaPoolcfg) {
t.Error(cgrCfg.RALsPubSubSConns)
}
if !reflect.DeepEqual(cgrCfg.RALsAttributeSConns, eHaPoolcfg) {
t.Error(cgrCfg.RALsAttributeSConns)
}
if !reflect.DeepEqual(cgrCfg.RALsUserSConns, eHaPoolcfg) {
t.Error(cgrCfg.RALsUserSConns)
}

View File

@@ -96,7 +96,6 @@ type RalsJsonCfg struct {
Cdrstats_conns *[]*HaPoolJsonCfg
Stats_conns *[]*HaPoolJsonCfg
Pubsubs_conns *[]*HaPoolJsonCfg
Attributes_conns *[]*HaPoolJsonCfg
Aliases_conns *[]*HaPoolJsonCfg
Users_conns *[]*HaPoolJsonCfg
Rp_subject_prefix_matching *bool

View File

@@ -538,6 +538,7 @@ CREATE TABLE tp_attributes (
`initial` varchar(64) NOT NULL,
`substitute` varchar(64) NOT NULL,
`append` BOOLEAN NOT NULL,
`blocker` BOOLEAN NOT NULL,
`weight` decimal(8,2) NOT NULL,
`created_at` TIMESTAMP,
PRIMARY KEY (`pk`),

View File

@@ -529,6 +529,7 @@ CREATE INDEX tp_suppliers_unique ON tp_suppliers ("tpid", "tenant", "id",
"initial" varchar(64) NOT NULL,
"substitute" varchar(64) NOT NULL,
"append" BOOLEAN NOT NULL,
"blocker" BOOLEAN NOT NULL,
"weight" decimal(8,2) NOT NULL,
"created_at" TIMESTAMP WITH TIME ZONE
);

View File

@@ -46,7 +46,6 @@ type AttrGetLcr struct {
type Responder struct {
ExitChan chan bool
CdrStats rpcclient.RpcClientConnection
AttributeS rpcclient.RpcClientConnection
Timeout time.Duration
Timezone string
MaxComputedUsage map[string]time.Duration