From 750260505cdf94fd0d4671de5f2dd1c69235efd5 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Fri, 31 Jan 2014 17:22:32 +0200 Subject: [PATCH] build fix --- apier/v1/accounts.go | 5 +++-- scheduler/scheduler.go | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apier/v1/accounts.go b/apier/v1/accounts.go index c96b7f653..a9bc9d5d8 100644 --- a/apier/v1/accounts.go +++ b/apier/v1/accounts.go @@ -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())}) } } } diff --git a/scheduler/scheduler.go b/scheduler/scheduler.go index 14a1a50eb..dacc596e7 100644 --- a/scheduler/scheduler.go +++ b/scheduler/scheduler.go @@ -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 {