mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Added connection reload for ERs
This commit is contained in:
committed by
Dan Christian Bogos
parent
45ab2f9257
commit
146feb0ca5
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user