From 9dfd36e7f277c3e62ab9c01d4158a149ce3237ec Mon Sep 17 00:00:00 2001 From: gezimbll Date: Tue, 28 May 2024 05:09:00 -0400 Subject: [PATCH] updated RemTpData to check args map in switch case --- engine/storage_internal_stordb.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/engine/storage_internal_stordb.go b/engine/storage_internal_stordb.go index 1cd76b568..e3a0b2a53 100644 --- a/engine/storage_internal_stordb.go +++ b/engine/storage_internal_stordb.go @@ -558,8 +558,23 @@ func (iDB *InternalDB) RemTpData(table, tpid string, args map[string]string) (er } key := tpid if args != nil { - for _, val := range args { - key += utils.CONCATENATED_KEY_SEP + val + switch table { + case utils.TBLTPAccountActions: + key += utils.CONCATENATED_KEY_SEP + args["loadid"] + + utils.CONCATENATED_KEY_SEP + args["tenant"] + + utils.CONCATENATED_KEY_SEP + args["account"] + case utils.TBLTPRateProfiles: + key += utils.CONCATENATED_KEY_SEP + args["loadid"] + + utils.CONCATENATED_KEY_SEP + args["tenant"] + + utils.CONCATENATED_KEY_SEP + args["category"] + + utils.CONCATENATED_KEY_SEP + args["subject"] + default: + if tag, has := args["tag"]; has { + key += utils.CONCATENATED_KEY_SEP + tag + } else if id, has := args["id"]; has { + key += utils.CONCATENATED_KEY_SEP + args["tenant"] + + utils.CONCATENATED_KEY_SEP + id + } } } ids := iDB.db.GetItemIDs(table, key)