Removed old threshold connection from resources

This commit is contained in:
Trial97
2020-10-06 13:56:31 +03:00
committed by Dan Christian Bogos
parent 668d9b7874
commit 830103a200

View File

@@ -28,7 +28,6 @@ import (
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/guardian"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
func init() {
@@ -310,8 +309,7 @@ func NewResourceService(dm *DataManager, cgrcfg *config.CGRConfig,
// ResourceService is the service handling resources
type ResourceService struct {
dm *DataManager // So we can load the data in cache and index it
thdS rpcclient.ClientConnector // allows applying filters based on stats
dm *DataManager // So we can load the data in cache and index it
filterS *FilterS
storedResources utils.StringMap // keep a record of resources which need saving, map[resID]bool
srMux sync.RWMutex // protects storedResources
@@ -411,7 +409,7 @@ func (rS *ResourceService) runBackup() {
// processThresholds will pass the event for resource to ThresholdS
func (rS *ResourceService) processThresholds(r *Resource, argDispatcher *utils.ArgDispatcher) (err error) {
if rS.thdS == nil {
if len(rS.cgrcfg.ResourceSCfg().ThresholdSConns) == 0 {
return
}
var thIDs []string
@@ -772,9 +770,3 @@ func (rS *ResourceService) Reload() {
func (rS *ResourceService) StartLoop() {
go rS.runBackup()
}
// SetThresholdConnection sets the new connection to the threshold service
// only used on reload
func (rS *ResourceService) SetThresholdConnection(thdS rpcclient.ClientConnector) {
rS.thdS = thdS
}