Removed old threshold connection from resources

This commit is contained in:
Trial97
2020-10-06 13:52:14 +03:00
committed by Dan Christian Bogos
parent cc406e4392
commit 5c558545bd

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() {
@@ -327,8 +326,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
@@ -428,7 +426,7 @@ func (rS *ResourceService) runBackup() {
// processThresholds will pass the event for resource to ThresholdS
func (rS *ResourceService) processThresholds(r *Resource, opts map[string]interface{}) (err error) {
if rS.thdS == nil {
if len(rS.cgrcfg.ResourceSCfg().ThresholdSConns) == 0 {
return
}
var thIDs []string
@@ -807,9 +805,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
}