added passing events from thresholds to ees

This commit is contained in:
gezimbll
2025-05-26 08:49:42 +02:00
committed by Dan Christian Bogos
parent 90de059801
commit ccdf3ef1f1
24 changed files with 288 additions and 121 deletions

View File

@@ -34,7 +34,7 @@ import (
// NewThresholdService returns the Threshold Service
func NewThresholdService(cfg *config.CGRConfig, dm *DataDBService,
cacheS *engine.CacheS, filterSChan chan *engine.FilterS,
server *cores.Server, internalThresholdSChan chan birpc.ClientConnector,
server *cores.Server, internalThresholdSChan chan birpc.ClientConnector, connMgr *engine.ConnManager,
anz *AnalyzerService, srvDep map[string]*sync.WaitGroup) servmanager.Service {
return &ThresholdService{
connChan: internalThresholdSChan,
@@ -43,6 +43,7 @@ func NewThresholdService(cfg *config.CGRConfig, dm *DataDBService,
cacheS: cacheS,
filterSChan: filterSChan,
server: server,
connMgr: connMgr,
anz: anz,
srvDep: srvDep,
}
@@ -56,6 +57,7 @@ type ThresholdService struct {
cacheS *engine.CacheS
filterSChan chan *engine.FilterS
server *cores.Server
connMgr *engine.ConnManager
thrs *engine.ThresholdService
connChan chan birpc.ClientConnector
@@ -82,7 +84,7 @@ func (thrs *ThresholdService) Start() error {
thrs.Lock()
defer thrs.Unlock()
thrs.thrs = engine.NewThresholdService(datadb, thrs.cfg, filterS)
thrs.thrs = engine.NewThresholdService(datadb, thrs.cfg, filterS, thrs.connMgr)
utils.Logger.Info(fmt.Sprintf("<%s> starting <%s> subsystem", utils.CoreS, utils.ThresholdS))
thrs.thrs.StartLoop()

View File

@@ -40,11 +40,11 @@ func TestThresholdSCoverage(t *testing.T) {
srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)}
anz := NewAnalyzerService(cfg, server, filterSChan, shdChan, make(chan birpc.ClientConnector, 1), srvDep)
db := NewDataDBService(cfg, nil, false, srvDep)
tS := NewThresholdService(cfg, db, chS, filterSChan, server, make(chan birpc.ClientConnector, 1), anz, srvDep)
tS := NewThresholdService(cfg, db, chS, filterSChan, server, make(chan birpc.ClientConnector, 1), nil, anz, srvDep)
if tS.IsRunning() {
t.Errorf("Expected service to be down")
}
thrs1 := engine.NewThresholdService(&engine.DataManager{}, &config.CGRConfig{}, &engine.FilterS{})
thrs1 := engine.NewThresholdService(&engine.DataManager{}, &config.CGRConfig{}, &engine.FilterS{}, nil)
tS2 := &ThresholdService{
cfg: cfg,
dm: db,