mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
apier load fixes
This commit is contained in:
@@ -265,7 +265,11 @@ func (self *ApierV1) LoadRatingPlan(attrs AttrLoadRatingPlan, reply *string) err
|
||||
//Automatic cache of the newly inserted rating plan
|
||||
var changedRPlKeys []string
|
||||
if len(attrs.TPid) != 0 {
|
||||
changedRPlKeys = []string{utils.RATING_PLAN_PREFIX + attrs.RatingPlanId}
|
||||
if attrs.RatingPlanId != "" {
|
||||
changedRPlKeys = []string{utils.RATING_PLAN_PREFIX + attrs.RatingPlanId}
|
||||
} else {
|
||||
changedRPlKeys = nil
|
||||
}
|
||||
}
|
||||
if err := self.RatingDb.CacheRatingPrefixValues(map[string][]string{
|
||||
utils.DESTINATION_PREFIX: nil,
|
||||
|
||||
@@ -81,7 +81,7 @@ func (self *ApierV2) LoadAccountActions(attrs AttrLoadAccountActions, reply *str
|
||||
}
|
||||
// ToDo: Get the action keys loaded by dbReader so we reload only these in cache
|
||||
// Need to do it before scheduler otherwise actions to run will be unknown
|
||||
if err := self.RatingDb.CacheRatingPrefixes(utils.DERIVED_CHARGERS_CSV, utils.ACTION_PREFIX, utils.SHARED_GROUP_PREFIX); err != nil {
|
||||
if err := self.RatingDb.CacheRatingPrefixes(utils.DERIVEDCHARGERS_PREFIX, utils.ACTION_PREFIX, utils.SHARED_GROUP_PREFIX); err != nil {
|
||||
return err
|
||||
}
|
||||
if self.Sched != nil {
|
||||
|
||||
@@ -681,17 +681,22 @@ func (tpr *TpReader) LoadAccountActionsFiltered(qriedAA *TpAccountAction) error
|
||||
} else if len(actions) == 0 {
|
||||
return fmt.Errorf("no action with id <%s>", at.ActionsId)
|
||||
}
|
||||
tptm, err := tpr.lr.GetTpTimings(tpr.tpid, at.TimingId)
|
||||
if err != nil {
|
||||
return errors.New(err.Error() + " (Timing): " + at.TimingId)
|
||||
} else if len(tptm) == 0 {
|
||||
return fmt.Errorf("no timing with id <%s>", at.TimingId)
|
||||
var t *utils.TPTiming
|
||||
if at.TimingId != utils.ASAP {
|
||||
tptm, err := tpr.lr.GetTpTimings(tpr.tpid, at.TimingId)
|
||||
if err != nil {
|
||||
return errors.New(err.Error() + " (Timing): " + at.TimingId)
|
||||
} else if len(tptm) == 0 {
|
||||
return fmt.Errorf("no timing with id <%s>", at.TimingId)
|
||||
}
|
||||
tm, err := TpTimings(tptm).GetTimings()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t = tm[at.TimingId]
|
||||
} else {
|
||||
t = tpr.timings[at.TimingId] // *asap
|
||||
}
|
||||
tm, err := TpTimings(tptm).GetTimings()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t := tm[at.TimingId]
|
||||
actTmg := &ActionPlan{
|
||||
Uuid: utils.GenUUID(),
|
||||
Id: accountAction.ActionPlanId,
|
||||
|
||||
Reference in New Issue
Block a user