mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
save *asap action timings with empty account id list
This commit is contained in:
@@ -217,6 +217,9 @@ func (at *ActionTiming) getActions() (as []*Action, err error) {
|
||||
}
|
||||
|
||||
func (at *ActionTiming) Execute() (err error) {
|
||||
if len(at.AccountIds) == 0 { // nothing to do if no accounts set
|
||||
return
|
||||
}
|
||||
at.resetStartTimeCache()
|
||||
aac, err := at.getActions()
|
||||
if err != nil {
|
||||
|
||||
@@ -90,8 +90,13 @@ func (s *Scheduler) LoadActionTimings(storage engine.AccountingStorage) {
|
||||
isAsap = at.IsASAP()
|
||||
toBeSaved = toBeSaved || isAsap
|
||||
if isAsap {
|
||||
engine.Logger.Info(fmt.Sprintf("Time for one time action on %v", key))
|
||||
go at.Execute()
|
||||
if len(at.AccountIds) > 0 {
|
||||
engine.Logger.Info(fmt.Sprintf("Time for one time action on %v", key))
|
||||
}
|
||||
go func() {
|
||||
at.Execute()
|
||||
at.AccountIds = make([]string, 0)
|
||||
}()
|
||||
// do not append it to the newAts list to be saved
|
||||
} else {
|
||||
now := time.Now()
|
||||
@@ -100,8 +105,9 @@ func (s *Scheduler) LoadActionTimings(storage engine.AccountingStorage) {
|
||||
continue
|
||||
}
|
||||
s.queue = append(s.queue, at)
|
||||
newAts = append(newAts, at)
|
||||
}
|
||||
// save even asap action timings with empty account id list
|
||||
newAts = append(newAts, at)
|
||||
}
|
||||
if toBeSaved {
|
||||
engine.AccLock.Guard(engine.ACTION_TIMING_PREFIX, func() (float64, error) {
|
||||
|
||||
Reference in New Issue
Block a user