Fix return at LRUStore, SMGeneric to properly check EXISTS error

This commit is contained in:
DanB
2016-08-30 09:59:09 +02:00
parent db02afe33e
commit 7bd3a430d2
2 changed files with 2 additions and 1 deletions

View File

@@ -176,6 +176,7 @@ func (cs lrustore) Put(key string, value interface{}) {
mp, err = lru.New(10000)
if err != nil {
utils.Logger.Debug(fmt.Sprintf("<cache>: error at init: %v", err))
return
}
cs.store[prefix] = mp
}

View File

@@ -562,7 +562,7 @@ func (self *SMGeneric) ChargeEvent(gev SMGenericEvent, clnt *rpc2.Client) (maxDu
OriginID: gev.GetUUID(),
CostDetails: cc,
}
if err := self.cdrsrv.Call("CdrsV1.StoreSMCost", engine.AttrCDRSStoreSMCost{Cost: smCost, CheckDuplicate: true}, &reply); err != nil && err.Error() != utils.ErrExists.Error() {
if err := self.cdrsrv.Call("CdrsV1.StoreSMCost", engine.AttrCDRSStoreSMCost{Cost: smCost, CheckDuplicate: true}, &reply); err != nil && !strings.HasSuffix(err.Error(), utils.ErrExists.Error()) {
withErrors = true
utils.Logger.Err(fmt.Sprintf("<SMGeneric> Could not save CC: %+v, RunID: %s error: %s", cc, sR.DerivedCharger.RunID, err.Error()))
}