compilation fixes

This commit is contained in:
Radu Ioan Fericean
2015-08-11 16:44:53 +03:00
parent 93c85c48be
commit 9f2a36b0e5
4 changed files with 15 additions and 8 deletions

View File

@@ -156,7 +156,9 @@ func main() {
path.Join(*dataPath, utils.ACCOUNT_ACTIONS_CSV),
path.Join(*dataPath, utils.DERIVED_CHARGERS_CSV),
path.Join(*dataPath, utils.CDR_STATS_CSV),
path.Join(*dataPath, utils.USERS_CSV))
path.Join(*dataPath, utils.USERS_CSV),
path.Join(*dataPath, utils.ALIASES_CSV),
)
}
tpReader := engine.NewTpReader(ratingDb, accountDb, loader, *tpid)
err = tpReader.LoadAll()
@@ -236,8 +238,7 @@ func main() {
rpfIds, _ := tpReader.GetLoadedIds(utils.RATING_PROFILE_PREFIX)
actIds, _ := tpReader.GetLoadedIds(utils.ACTION_PREFIX)
shgIds, _ := tpReader.GetLoadedIds(utils.SHARED_GROUP_PREFIX)
rpAliases, _ := tpReader.GetLoadedIds(utils.RP_ALIAS_PREFIX)
accAliases, _ := tpReader.GetLoadedIds(utils.ACC_ALIAS_PREFIX)
aliases, _ := tpReader.GetLoadedIds(utils.ALIASES_PREFIX)
lcrIds, _ := tpReader.GetLoadedIds(utils.LCR_PREFIX)
dcs, _ := tpReader.GetLoadedIds(utils.DERIVEDCHARGERS_PREFIX)
// Reload cache first since actions could be calling info from within
@@ -245,7 +246,7 @@ func main() {
log.Print("Reloading cache")
}
if *flush {
dstIds, rplIds, rpfIds, rpAliases, lcrIds = nil, nil, nil, nil, nil // Should reload all these on flush
dstIds, rplIds, rpfIds, lcrIds = nil, nil, nil, nil // Should reload all these on flush
}
if err = rater.Call("ApierV1.ReloadCache", utils.ApiReloadCache{
DestinationIds: dstIds,
@@ -253,8 +254,7 @@ func main() {
RatingProfileIds: rpfIds,
ActionIds: actIds,
SharedGroupIds: shgIds,
RpAliases: rpAliases,
AccAliases: accAliases,
Aliases: aliases,
LCRIds: lcrIds,
DerivedChargers: dcs,
}, &reply); err != nil {

View File

@@ -77,9 +77,12 @@ func durInternalRater(cd *engine.CallDescriptor) (time.Duration, error) {
}
defer accountDb.Close()
engine.SetAccountingStorage(accountDb)
if err := ratingDb.CacheAll(); err != nil {
if err := ratingDb.CacheRatingAll(); err != nil {
return nilDuration, fmt.Errorf("Cache rating error: %s", err.Error())
}
if err := accountDb.CacheAccountingAll(); err != nil {
return nilDuration, fmt.Errorf("Cache accounting error: %s", err.Error())
}
log.Printf("Runnning %d cycles...", *runs)
var result *engine.CallCost
j := 0

View File

@@ -351,6 +351,10 @@ type TpAlias struct {
Weight float64 `index:"8" re:""`
}
func (ta *TpAlias) TableName() string {
return "tp_aliases"
}
func (ta *TpAlias) GetId() string {
return utils.ConcatenatedKey(ta.Direction, ta.Tenant, ta.Category, ta.Account, ta.Subject, ta.Group)
}

View File

@@ -142,7 +142,7 @@ type LoadWriter interface {
SetTpSharedGroups([]TpSharedGroup) error
SetTpCdrStats([]TpCdrstat) error
SetTpUsers([]TpUser) error
SetTpAlias([]TpAlias) error
SetTpAliases([]TpAlias) error
SetTpDerivedChargers([]TpDerivedCharger) error
SetTpLCRs([]TpLcrRule) error
SetTpActions([]TpAction) error