Ejemplo n.º 1
0
func startBalancer(internalBalancerChan chan *balancer2go.Balancer, stopHandled *bool, exitChan chan bool) {
	bal := balancer2go.NewBalancer()
	go stopBalancerSignalHandler(bal, exitChan)
	*stopHandled = true
	internalBalancerChan <- bal
}
Ejemplo n.º 2
0
	REDIS    = "redis"
	SAME     = "same"
	FS       = "freeswitch"
	OSIPS    = "opensips"
)

var (
	cfgPath         = flag.String("config", "/etc/cgrates/cgrates.cfg", "Configuration file location.")
	version         = flag.Bool("version", false, "Prints the application version.")
	raterEnabled    = flag.Bool("rater", false, "Enforce starting of the rater daemon overwriting config")
	schedEnabled    = flag.Bool("scheduler", false, "Enforce starting of the scheduler daemon .overwriting config")
	cdrsEnabled     = flag.Bool("cdrs", false, "Enforce starting of the cdrs daemon overwriting config")
	cdrcEnabled     = flag.Bool("cdrc", false, "Enforce starting of the cdrc service overwriting config")
	mediatorEnabled = flag.Bool("mediator", false, "Enforce starting of the mediator service overwriting config")
	pidFile         = flag.String("pid", "", "Write pid file")
	bal             = balancer2go.NewBalancer()
	exitChan        = make(chan bool)
	server          = &engine.Server{}
	scribeServer    history.Scribe
	cdrServer       *engine.CDRS
	cdrStats        *engine.Stats
	sm              sessionmanager.SessionManager
	medi            *engine.Mediator
	cfg             *config.CGRConfig
	err             error
)

func cacheData(ratingDb engine.RatingStorage, accountDb engine.AccountingStorage, doneChan chan struct{}) {
	if err := ratingDb.CacheRating(nil, nil, nil, nil, nil); err != nil {
		engine.Logger.Crit(fmt.Sprintf("Cache rating error: %s", err.Error()))
		exitChan <- true