mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 21:59:53 +05:00
SMG SessionTimers considering LastUsed, generating also CDR
This commit is contained in:
@@ -426,7 +426,7 @@ func TestSMGDataTTLExpired(t *testing.T) {
|
||||
t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.DATA].GetTotalValue())
|
||||
}
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
eAcntVal = 49999897600.000000
|
||||
eAcntVal = 49999887360.000000
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.DATA].GetTotalValue() != eAcntVal {
|
||||
|
||||
@@ -65,7 +65,12 @@ func (self *SMGeneric) indexSession(uuid string, s *SMGSession) {
|
||||
go func() {
|
||||
select {
|
||||
case <-timer.C:
|
||||
self.sessionEnd(uuid, 0)
|
||||
totalUsage := s.TotalUsage() + self.cgrCfg.SmGenericConfig.SessionTTL
|
||||
self.sessionEnd(uuid, totalUsage)
|
||||
cdr := s.eventStart.AsStoredCdr(self.cgrCfg, self.timezone)
|
||||
cdr.Usage = totalUsage
|
||||
var reply string
|
||||
self.cdrsrv.ProcessCdr(cdr, &reply)
|
||||
case <-endChan:
|
||||
timer.Stop()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user