Add Filter in Cache

This commit is contained in:
TeoV
2017-10-25 17:39:26 +03:00
committed by Dan Christian Bogos
parent 383d0f3257
commit ff92d3f5a4
27 changed files with 115 additions and 45 deletions

View File

@@ -43,7 +43,7 @@ func startRater(internalRaterChan chan rpcclient.RpcClientConnection, cacheDoneC
waitTasks = append(waitTasks, cacheTaskChan)
go func() {
defer close(cacheTaskChan)
var dstIDs, rvDstIDs, rplIDs, rpfIDs, actIDs, aplIDs, aapIDs, atrgIDs, sgIDs, lcrIDs, dcIDs, alsIDs, rvAlsIDs, rspIDs, resIDs, stqIDs, stqpIDs, thIDs, thpIDs []string
var dstIDs, rvDstIDs, rplIDs, rpfIDs, actIDs, aplIDs, aapIDs, atrgIDs, sgIDs, lcrIDs, dcIDs, alsIDs, rvAlsIDs, rspIDs, resIDs, stqIDs, stqpIDs, thIDs, thpIDs, fltrIDs []string
if cCfg, has := cfg.CacheConfig[utils.CacheDestinations]; !has || !cCfg.Precache {
dstIDs = make([]string, 0) // Don't cache any
}
@@ -101,9 +101,12 @@ func startRater(internalRaterChan chan rpcclient.RpcClientConnection, cacheDoneC
if cCfg, has := cfg.CacheConfig[utils.CacheThresholdProfiles]; !has || !cCfg.Precache {
thpIDs = make([]string, 0)
}
if cCfg, has := cfg.CacheConfig[utils.CacheFilters]; !has || !cCfg.Precache {
fltrIDs = make([]string, 0)
}
// ToDo: Add here timings
if err := dm.LoadDataDBCache(dstIDs, rvDstIDs, rplIDs, rpfIDs, actIDs, aplIDs, aapIDs, atrgIDs, sgIDs, lcrIDs, dcIDs, alsIDs, rvAlsIDs, rspIDs, resIDs, stqIDs, stqpIDs, thIDs, thpIDs); err != nil {
if err := dm.LoadDataDBCache(dstIDs, rvDstIDs, rplIDs, rpfIDs, actIDs, aplIDs, aapIDs, atrgIDs, sgIDs, lcrIDs, dcIDs, alsIDs, rvAlsIDs, rspIDs, resIDs, stqIDs, stqpIDs, thIDs, thpIDs, fltrIDs); err != nil {
utils.Logger.Crit(fmt.Sprintf("<RALs> Cache rating error: %s", err.Error()))
exitChan <- true
return

View File

@@ -67,7 +67,7 @@ func durInternalRater(cd *engine.CallDescriptor) (time.Duration, error) {
}
defer dm.DataDB().Close()
engine.SetDataStorage(dm)
if err := dm.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil); err != nil {
if err := dm.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil); err != nil {
return nilDuration, fmt.Errorf("Cache rating error: %s", err.Error())
}
log.Printf("Runnning %d cycles...", *runs)