build fix

This commit is contained in:
Radu Ioan Fericean
2014-01-31 17:22:32 +02:00
parent d90e67b966
commit 750260505c
2 changed files with 5 additions and 4 deletions

View File

@@ -21,9 +21,10 @@ package apier
import (
"errors"
"fmt"
"time"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
"time"
)
type AttrAcntAction struct {
@@ -51,7 +52,7 @@ func (self *ApierV1) GetAccountActionPlan(attrs AttrAcntAction, reply *[]*Accoun
for _, ats := range allATs {
for _, at := range ats {
if utils.IsSliceMember(at.UserBalanceIds, utils.BalanceKey(attrs.Tenant, attrs.Account, attrs.Direction)) {
accountATs = append(accountATs, &AccountActionTiming{Id: at.Id, ActionPlanId: at.Tag, ActionsId: at.ActionsId, NextExecTime: at.GetNextStartTime()})
accountATs = append(accountATs, &AccountActionTiming{Id: at.Id, ActionPlanId: at.Tag, ActionsId: at.ActionsId, NextExecTime: at.GetNextStartTime(time.Now())})
}
}
}

View File

@@ -46,7 +46,7 @@ func (s *Scheduler) Loop() {
s.Lock()
a0 := s.queue[0]
now := time.Now()
if a0.GetNextStartTime().Equal(now) || a0.GetNextStartTime().Before(now) {
if a0.GetNextStartTime(now).Equal(now) || a0.GetNextStartTime(now).Before(now) {
engine.Logger.Debug(fmt.Sprintf("%v - %v", a0.Tag, a0.Timing))
go a0.Execute()
s.queue = append(s.queue, a0)
@@ -55,7 +55,7 @@ func (s *Scheduler) Loop() {
s.Unlock()
} else {
s.Unlock()
d := a0.GetNextStartTime().Sub(now)
d := a0.GetNextStartTime(now).Sub(now)
// engine.Logger.Info(fmt.Sprintf("Timer set to wait for %v", d))
s.timer = time.NewTimer(d)
select {