From 0f974ce9a0ee89eb81cdee65235593cde8a8df68 Mon Sep 17 00:00:00 2001 From: DanB Date: Fri, 19 Apr 2019 18:37:37 +0200 Subject: [PATCH] Proper init of cache options --- apier/v2/attributes.go | 13 ++++++++----- utils/apitpdata.go | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apier/v2/attributes.go b/apier/v2/attributes.go index bfe1b582e..795f65634 100644 --- a/apier/v2/attributes.go +++ b/apier/v2/attributes.go @@ -32,11 +32,11 @@ type AttributeWithCache struct { } //SetAttributeProfile add/update a new Attribute Profile -func (apierV2 *ApierV2) SetAttributeProfile(extAlsPrfWrp *AttributeWithCache, reply *string) error { - if missing := utils.MissingStructFields(extAlsPrfWrp.ExternalAttributeProfile, []string{"Tenant", "ID"}); len(missing) != 0 { +func (apierV2 *ApierV2) SetAttributeProfile(arg *AttributeWithCache, reply *string) error { + if missing := utils.MissingStructFields(arg.ExternalAttributeProfile, []string{utils.Tenant, utils.ID}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } - alsPrf, err := extAlsPrfWrp.ExternalAttributeProfile.AsAttributeProfile() + alsPrf, err := arg.ExternalAttributeProfile.AsAttributeProfile() if err != nil { return utils.APIErrorHandler(err) } @@ -44,14 +44,17 @@ func (apierV2 *ApierV2) SetAttributeProfile(extAlsPrfWrp *AttributeWithCache, re return utils.APIErrorHandler(err) } //generate a loadID for CacheAttributeProfiles and store it in database - if err := apierV2.DataManager.SetLoadIDs(map[string]int64{utils.CacheAttributeProfiles: time.Now().UnixNano()}); err != nil { + if err := apierV2.DataManager.SetLoadIDs( + map[string]int64{utils.CacheAttributeProfiles: time.Now().UnixNano()}); err != nil { return utils.APIErrorHandler(err) } args := engine.ArgsGetCacheItem{ CacheID: utils.CacheAttributeProfiles, ItemID: alsPrf.TenantID(), } - if err := apierV2.CallCache(v1.GetCacheOpt(extAlsPrfWrp.Cache), args); err != nil { + if err := apierV2.ApierV1.CallCache( + v1.GetCacheOpt(arg.Cache), + args); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/utils/apitpdata.go b/utils/apitpdata.go index 9db2b438f..944660410 100755 --- a/utils/apitpdata.go +++ b/utils/apitpdata.go @@ -515,8 +515,9 @@ func InitAttrReloadCache() (rpl AttrReloadCache) { rpl.AttributeProfileIDs = &[]string{} rpl.ChargerProfileIDs = &[]string{} rpl.DispatcherProfileIDs = &[]string{} + rpl.DispatcherHostIDs = &[]string{} rpl.DispatcherRoutesIDs = &[]string{} - return rpl + return } type CacheKeys struct {