Added connection reload for ERs

This commit is contained in:
Trial97
2019-09-25 14:33:33 +03:00
committed by Dan Christian Bogos
parent 45ab2f9257
commit 146feb0ca5
2 changed files with 13 additions and 0 deletions

View File

@@ -291,3 +291,9 @@ func (erS *ERService) processEvent(cgrEv *utils.CGREvent, rdrCfg *config.EventRe
return
}
// SetSessionSConnection sets the new connection to the threshold service
// only used on reload
func (erS *ERService) SetSessionSConnection(sS rpcclient.RpcClientConnection) {
erS.sS = sS
}

View File

@@ -82,7 +82,14 @@ func (erS *EventReaderService) GetIntenternalChan() (conn chan rpcclient.RpcClie
// Reload handles the change of config
func (erS *EventReaderService) Reload(sp servmanager.ServiceProvider) (err error) {
var sS rpcclient.RpcClientConnection
if sS, err = sp.GetConnection(utils.SessionS, sp.GetConfig().ERsCfg().SessionSConns); err != nil {
utils.Logger.Crit(fmt.Sprintf("<%s> failed connecting to <%s>, error: <%s>",
utils.ERs, utils.SessionS, err.Error()))
return
}
erS.RLock()
erS.ers.SetSessionSConnection(sS)
erS.rldChan <- struct{}{}
erS.RUnlock()
return