Updated *none request type handling

This commit is contained in:
Trial97
2021-04-26 16:52:07 +03:00
committed by Dan Christian Bogos
parent 13cd8e8a99
commit 912a124b7c
4 changed files with 9 additions and 6 deletions

View File

@@ -290,8 +290,8 @@ func testSSv1ItProcessEventInitiateSession(t *testing.T) {
expMaxUsage := map[string]time.Duration{
"CustomerCharges": initUsage,
"SupplierCharges": initUsage,
// "raw": initUsage,
utils.MetaRaw: initUsage,
"raw": initUsage,
utils.MetaRaw: initUsage,
}
if !reflect.DeepEqual(expMaxUsage, rply.MaxUsage) {
t.Errorf("Expected %s received %s", expMaxUsage, rply.MaxUsage)
@@ -395,8 +395,8 @@ func testSSv1ItProcessEventUpdateSession(t *testing.T) {
expMaxUsage := map[string]time.Duration{
"CustomerCharges": reqUsage,
"SupplierCharges": reqUsage,
// "raw": reqUsage,
utils.MetaRaw: reqUsage,
"raw": reqUsage,
utils.MetaRaw: reqUsage,
}
if !reflect.DeepEqual(expMaxUsage, rply.MaxUsage) {
t.Errorf("Expected %s received %s", expMaxUsage, rply.MaxUsage)

View File

@@ -38,7 +38,7 @@ func MatchingItemIDsForEvent(ev utils.MapStorage, stringFldIDs, prefixFldIDs, su
}
// Guard will protect the function with automatic locking
lockID := utils.CacheInstanceToPrefix[cacheID] + itemIDPrefix
guardian.Guardian.Guard(func() (gRes interface{}, gErr error) {
guardian.Guardian.Guard(func() (_ interface{}, _ error) {
if !indexedSelects {
var keysWithID []string
if keysWithID, err = dm.DataDB().GetKeysForPrefix(utils.CacheIndexesToPrefix[cacheID]); err != nil {
@@ -58,7 +58,8 @@ func MatchingItemIDsForEvent(ev utils.MapStorage, stringFldIDs, prefixFldIDs, su
fieldIDs = &allFieldIDs
}
for _, fldName := range *fieldIDs {
fieldValIf, err := ev.FieldAsInterface(strings.Split(fldName, utils.NestingSep))
var fieldValIf interface{}
fieldValIf, err = ev.FieldAsInterface(strings.Split(fldName, utils.NestingSep))
if err != nil && filterIndexTypes[i] != utils.MetaNone {
continue
}

View File

@@ -154,6 +154,7 @@ cgrates (0.11.0~dev) UNRELEASED; urgency=medium
* [Templates] Added support for multiple indexes
* [AgentS] Added ~*req prefix for freeswitch extra_fields
* [AgentS] Changed NavigableMap with DataNode for speed improvements
* [SessionS] RequestType *none returns back the requested usage
-- DanB <danb@cgrates.org> Wed, 19 Feb 2020 13:25:52 +0200

View File

@@ -1502,6 +1502,7 @@ func (sS *SessionS) updateSession(s *Session, updtEv, opts engine.MapEvent, isMs
for i, sr := range s.SRuns {
reqType := sr.Event.GetStringIgnoreErrors(utils.RequestType)
if reqType == utils.MetaNone {
maxUsage[sr.CD.RunID] = reqMaxUsage
continue
}
var rplyMaxUsage time.Duration