Init cM,caps,cls,wg inside CGREngine constructor

Also pass the profile to the CGREngine struct the moment profiling started.
This commit is contained in:
ionutboangiu
2024-11-07 15:18:15 +02:00
committed by Dan Christian Bogos
parent 0d9358cf30
commit e78722ae4e
2 changed files with 45 additions and 49 deletions

View File

@@ -23,13 +23,10 @@ import (
"log"
"os"
"runtime"
"sync"
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/commonlisteners"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/cores"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/services"
"github.com/cgrates/cgrates/utils"
)
@@ -60,9 +57,7 @@ func RunCGREngine(fs []string) (err error) {
if cfg, err = services.InitConfigFromPath(ctx, *flags.CfgPath, *flags.NodeID, *flags.LogLevel); err != nil || *flags.CheckConfig {
return
}
cps := engine.NewCaps(cfg.CoreSCfg().Caps, cfg.CoreSCfg().CapsStrategy)
cls := commonlisteners.NewCommonListenerS(cps)
cgr := services.NewCGREngine(cfg, engine.NewConnManager(cfg), new(sync.WaitGroup), cls, cps)
cgr := services.NewCGREngine(cfg)
defer cgr.Stop(*flags.PidFile)
if err = cgr.Init(ctx, cancel, flags, vers); err != nil {