mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
write tasks on loadaccountactions
This commit is contained in:
@@ -806,7 +806,7 @@ func (self *ApierV1) LoadAccountActions(attrs utils.TPAccountActions, 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.DERIVEDCHARGERS_PREFIX, utils.ACTION_PREFIX, utils.SHARED_GROUP_PREFIX); err != nil {
|
||||
if err := self.RatingDb.CacheRatingPrefixes(utils.DERIVEDCHARGERS_PREFIX, utils.ACTION_PREFIX, utils.SHARED_GROUP_PREFIX, utils.ACTION_PLAN_PREFIX); err != nil {
|
||||
return err
|
||||
}
|
||||
if self.Sched != nil {
|
||||
|
||||
@@ -732,6 +732,21 @@ func (tpr *TpReader) LoadAccountActionsFiltered(qriedAA *TpAccountAction) error
|
||||
actionPlan.AccountIDs = exitingAccountIds
|
||||
}
|
||||
|
||||
// write tasks
|
||||
for _, at := range actionPlan.ActionTimings {
|
||||
if at.IsASAP() {
|
||||
for accID := range actionPlan.AccountIDs {
|
||||
t := &Task{
|
||||
Uuid: utils.GenUUID(),
|
||||
AccountID: accID,
|
||||
ActionsID: at.ActionsID,
|
||||
}
|
||||
if err = tpr.ratingStorage.PushTask(t); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// write action plan
|
||||
err = tpr.ratingStorage.SetActionPlan(accountAction.ActionPlanId, actionPlan)
|
||||
if err != nil {
|
||||
|
||||
@@ -96,7 +96,7 @@ func (s *Scheduler) loadActionPlans() {
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
// limit the number of concurrent tasks
|
||||
var limit = make(chan bool, 10)
|
||||
limit := make(chan bool, 10)
|
||||
// execute existing tasks
|
||||
for {
|
||||
task, err := s.storage.PopTask()
|
||||
|
||||
Reference in New Issue
Block a user