mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-17 22:29:55 +05:00
Add protection for cdr Usage smaller than 0
This commit is contained in:
committed by
Dan Christian Bogos
parent
01955bb612
commit
8c8f1370e8
@@ -217,6 +217,9 @@ func (self *CdrServer) processCdr(cdr *CDR) (err error) {
|
||||
if len(self.cgrCfg.CdrsCfg().CDRSOnlineCDRExports) != 0 { // Replicate raw CDR
|
||||
self.replicateCDRs([]*CDR{cdr})
|
||||
}
|
||||
if cdr.Usage < time.Duration(0) {
|
||||
cdr.Usage = time.Duration(0)
|
||||
}
|
||||
if self.rals != nil && !cdr.PreRated { // CDRs not rated will be processed by Rating
|
||||
go self.deriveRateStoreStatsReplicate(cdr, self.cgrCfg.CdrsCfg().CDRSStoreCdrs,
|
||||
true, len(self.cgrCfg.CdrsCfg().CDRSOnlineCDRExports) != 0)
|
||||
@@ -405,6 +408,9 @@ func (self *CdrServer) rateCDR(cdr *CDR) ([]*CDR, error) {
|
||||
if cdr.RequestType == utils.META_NONE {
|
||||
return nil, nil
|
||||
}
|
||||
if cdr.Usage < 0 {
|
||||
cdr.Usage = time.Duration(0)
|
||||
}
|
||||
cdr.ExtraInfo = "" // Clean previous ExtraInfo, useful when re-rating
|
||||
var cdrsRated []*CDR
|
||||
_, hasLastUsed := cdr.ExtraFields[utils.LastUsed]
|
||||
|
||||
Reference in New Issue
Block a user