diff --git a/apier/v1/apier.go b/apier/v1/apier.go index ff345c289..2ad1e2c3e 100644 --- a/apier/v1/apier.go +++ b/apier/v1/apier.go @@ -1220,7 +1220,7 @@ func (apiv1 *APIerSv1) ReplayFailedPosts(args ArgsReplyFailedPosts, reply *strin // CallCache caching the item based on cacheopt // visible in APIerSv2 -func (apiv1 *APIerSv1) CallCache(cacheOpt string, args utils.ArgsGetCacheItem) (err error) { +func (apiv1 *APIerSv1) CallCache(tnt, cacheOpt string, args utils.ArgsGetCacheItem) (err error) { var reply string switch cacheOpt { case utils.META_NONE: @@ -1228,24 +1228,29 @@ func (apiv1 *APIerSv1) CallCache(cacheOpt string, args utils.ArgsGetCacheItem) ( case utils.MetaReload: if err = apiv1.ConnMgr.Call(apiv1.Config.ApierCfg().CachesConns, nil, utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithArgDispatcher{ + TenantArg: utils.TenantArg{Tenant: tnt}, AttrReloadCache: composeArgsReload(args)}, &reply); err != nil { return err } case utils.MetaLoad: if err = apiv1.ConnMgr.Call(apiv1.Config.ApierCfg().CachesConns, nil, utils.CacheSv1LoadCache, utils.AttrReloadCacheWithArgDispatcher{ + TenantArg: utils.TenantArg{Tenant: tnt}, AttrReloadCache: composeArgsReload(args)}, &reply); err != nil { return err } case utils.MetaRemove: if err = apiv1.ConnMgr.Call(apiv1.Config.ApierCfg().CachesConns, nil, utils.CacheSv1RemoveItem, - &utils.ArgsGetCacheItemWithArgDispatcher{ArgsGetCacheItem: args}, &reply); err != nil { + &utils.ArgsGetCacheItemWithArgDispatcher{ + TenantArg: utils.TenantArg{Tenant: tnt}, + ArgsGetCacheItem: args}, &reply); err != nil { return err } case utils.MetaClear: if err = apiv1.ConnMgr.Call(apiv1.Config.ApierCfg().CachesConns, nil, utils.CacheSv1FlushCache, utils.AttrReloadCacheWithArgDispatcher{ + TenantArg: utils.TenantArg{Tenant: tnt}, AttrReloadCache: composeArgsReload(args)}, &reply); err != nil { return err } diff --git a/apier/v1/apier_it_test.go b/apier/v1/apier_it_test.go index 3d61b302a..29c26dc27 100644 --- a/apier/v1/apier_it_test.go +++ b/apier/v1/apier_it_test.go @@ -1020,6 +1020,7 @@ func testApierReloadCache(t *testing.T) { expectedStats[utils.CacheReverseDestinations].Items = 10 expectedStats[utils.CacheLoadIDs].Items = 20 expectedStats[utils.CacheRPCConnections].Items = 1 + expectedStats[utils.CacheActionTriggers].Items = 1 if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithArgDispatcher), &rcvStats); err != nil { t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error()) } else if !reflect.DeepEqual(expectedStats, rcvStats) { diff --git a/apier/v1/attributes.go b/apier/v1/attributes.go index 3d2cdce1e..50e1646c6 100644 --- a/apier/v1/attributes.go +++ b/apier/v1/attributes.go @@ -96,7 +96,7 @@ func (APIerSv1 *APIerSv1) SetAttributeProfile(alsWrp *AttributeWithCache, reply CacheID: utils.CacheAttributeProfiles, ItemID: alsWrp.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(alsWrp.Cache), args); err != nil { + if err := APIerSv1.CallCache(alsWrp.Tenant, GetCacheOpt(alsWrp.Cache), args); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -120,7 +120,7 @@ func (APIerSv1 *APIerSv1) RemoveAttributeProfile(arg *utils.TenantIDWithCache, r CacheID: utils.CacheAttributeProfiles, ItemID: utils.ConcatenatedKey(arg.Tenant, arg.ID), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), args); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), args); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/chargers.go b/apier/v1/chargers.go index ef1385da2..297c7e6bb 100644 --- a/apier/v1/chargers.go +++ b/apier/v1/chargers.go @@ -81,7 +81,7 @@ func (APIerSv1 *APIerSv1) SetChargerProfile(arg *ChargerWithCache, reply *string CacheID: utils.CacheChargerProfiles, ItemID: arg.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -106,7 +106,7 @@ func (APIerSv1 *APIerSv1) RemoveChargerProfile(arg *utils.TenantIDWithCache, rep CacheID: utils.CacheChargerProfiles, ItemID: arg.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/config_it_test.go b/apier/v1/config_it_test.go index d9b684709..55d6d858d 100644 --- a/apier/v1/config_it_test.go +++ b/apier/v1/config_it_test.go @@ -152,10 +152,10 @@ func testConfigSReloadConfigFromJSONSessionS(t *testing.T) { "StoreSCosts": false, "AlterableFields": map[string]interface{}{}, "DefaultUsage": map[string]interface{}{ - utils.META_ANY: "3h0m0s", - utils.VOICE: "3h0m0s", - utils.DATA: "1048576", - utils.SMS: "1", + utils.META_ANY: 10800000000000., + utils.VOICE: 10800000000000., + utils.DATA: 1048576., + utils.SMS: 1., }, } if *encoding == utils.MetaGOB { diff --git a/apier/v1/dispatcher.go b/apier/v1/dispatcher.go index 140d69580..c6b042dbc 100755 --- a/apier/v1/dispatcher.go +++ b/apier/v1/dispatcher.go @@ -86,7 +86,7 @@ func (APIerSv1 *APIerSv1) SetDispatcherProfile(args *DispatcherWithCache, reply CacheID: utils.CacheDispatcherProfiles, ItemID: args.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(args.Tenant, GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -111,7 +111,7 @@ func (APIerSv1 *APIerSv1) RemoveDispatcherProfile(arg *utils.TenantIDWithCache, CacheID: utils.CacheDispatcherProfiles, ItemID: arg.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -175,7 +175,7 @@ func (APIerSv1 *APIerSv1) SetDispatcherHost(args *DispatcherHostWithCache, reply CacheID: utils.CacheDispatcherHosts, ItemID: args.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(args.Tenant, GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -200,7 +200,7 @@ func (APIerSv1 *APIerSv1) RemoveDispatcherHost(arg *utils.TenantIDWithCache, rep CacheID: utils.CacheDispatcherHosts, ItemID: arg.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/filters.go b/apier/v1/filters.go index 56534d712..f10a543ca 100644 --- a/apier/v1/filters.go +++ b/apier/v1/filters.go @@ -47,7 +47,7 @@ func (APIerSv1 *APIerSv1) SetFilter(arg *FilterWithCache, reply *string) error { CacheID: utils.CacheFilters, ItemID: arg.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -105,7 +105,7 @@ func (APIerSv1 *APIerSv1) RemoveFilter(arg utils.TenantIDWithCache, reply *strin CacheID: utils.CacheFilters, ItemID: arg.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/resourcesv1.go b/apier/v1/resourcesv1.go index ae7e2bd4b..56835be1c 100644 --- a/apier/v1/resourcesv1.go +++ b/apier/v1/resourcesv1.go @@ -124,7 +124,7 @@ func (APIerSv1 *APIerSv1) SetResourceProfile(arg *ResourceWithCache, reply *stri CacheID: utils.CacheResourceProfiles, ItemID: arg.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } //add the resource only if it's not present @@ -142,7 +142,7 @@ func (APIerSv1 *APIerSv1) SetResourceProfile(arg *ResourceWithCache, reply *stri CacheID: utils.CacheResources, ItemID: arg.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } } @@ -164,7 +164,7 @@ func (APIerSv1 *APIerSv1) RemoveResourceProfile(arg utils.TenantIDWithCache, rep CacheID: utils.CacheResourceProfiles, ItemID: arg.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } if err := APIerSv1.DataManager.RemoveResource(arg.Tenant, arg.ID, utils.NonTransactional); err != nil { @@ -181,7 +181,7 @@ func (APIerSv1 *APIerSv1) RemoveResourceProfile(arg utils.TenantIDWithCache, rep CacheID: utils.CacheResources, ItemID: arg.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/stats.go b/apier/v1/stats.go index 07ca5e13e..f04497440 100644 --- a/apier/v1/stats.go +++ b/apier/v1/stats.go @@ -79,7 +79,7 @@ func (APIerSv1 *APIerSv1) SetStatQueueProfile(arg *engine.StatQueueWithCache, re CacheID: utils.CacheStatQueueProfiles, ItemID: arg.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } if has, err := APIerSv1.DataManager.HasData(utils.StatQueuePrefix, arg.ID, arg.Tenant); err != nil { @@ -102,7 +102,7 @@ func (APIerSv1 *APIerSv1) SetStatQueueProfile(arg *engine.StatQueueWithCache, re CacheID: utils.CacheStatQueues, ItemID: arg.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(arg.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(arg.Tenant, GetCacheOpt(arg.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } } @@ -124,7 +124,7 @@ func (APIerSv1 *APIerSv1) RemoveStatQueueProfile(args *utils.TenantIDWithCache, CacheID: utils.CacheStatQueueProfiles, ItemID: args.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(args.Tenant, GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } if err := APIerSv1.DataManager.RemoveStatQueue(args.Tenant, args.ID, utils.NonTransactional); err != nil { @@ -141,7 +141,7 @@ func (APIerSv1 *APIerSv1) RemoveStatQueueProfile(args *utils.TenantIDWithCache, CacheID: utils.CacheStatQueues, ItemID: args.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(args.Tenant, GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/suppliers.go b/apier/v1/suppliers.go index 3888a8182..65dc8636e 100644 --- a/apier/v1/suppliers.go +++ b/apier/v1/suppliers.go @@ -81,7 +81,7 @@ func (APIerSv1 *APIerSv1) SetSupplierProfile(args *SupplierWithCache, reply *str CacheID: utils.CacheSupplierProfiles, ItemID: args.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(args.Tenant, GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK @@ -105,7 +105,7 @@ func (APIerSv1 *APIerSv1) RemoveSupplierProfile(args *utils.TenantIDWithCache, r CacheID: utils.CacheSupplierProfiles, ItemID: args.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(args.Tenant, GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v1/thresholds.go b/apier/v1/thresholds.go index d975143b4..85b47efb0 100644 --- a/apier/v1/thresholds.go +++ b/apier/v1/thresholds.go @@ -113,7 +113,7 @@ func (APIerSv1 *APIerSv1) SetThresholdProfile(args *engine.ThresholdWithCache, r CacheID: utils.CacheThresholdProfiles, ItemID: args.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(args.Tenant, GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } @@ -128,7 +128,7 @@ func (APIerSv1 *APIerSv1) SetThresholdProfile(args *engine.ThresholdWithCache, r CacheID: utils.CacheThresholds, ItemID: args.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(args.Tenant, GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } } @@ -150,7 +150,7 @@ func (APIerSv1 *APIerSv1) RemoveThresholdProfile(args *utils.TenantIDWithCache, CacheID: utils.CacheThresholdProfiles, ItemID: args.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(args.Tenant, GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } if err := APIerSv1.DataManager.RemoveThreshold(args.Tenant, args.ID, utils.NonTransactional); err != nil { @@ -167,7 +167,7 @@ func (APIerSv1 *APIerSv1) RemoveThresholdProfile(args *utils.TenantIDWithCache, CacheID: utils.CacheThresholds, ItemID: args.TenantID(), } - if err := APIerSv1.CallCache(GetCacheOpt(args.Cache), argCache); err != nil { + if err := APIerSv1.CallCache(args.Tenant, GetCacheOpt(args.Cache), argCache); err != nil { return utils.APIErrorHandler(err) } *reply = utils.OK diff --git a/apier/v2/attributes.go b/apier/v2/attributes.go index e59613aee..6005dcd53 100644 --- a/apier/v2/attributes.go +++ b/apier/v2/attributes.go @@ -53,6 +53,7 @@ func (APIerSv2 *APIerSv2) SetAttributeProfile(arg *AttributeWithCache, reply *st ItemID: alsPrf.TenantID(), } if err := APIerSv2.APIerSv1.CallCache( + arg.Tenant, v1.GetCacheOpt(arg.Cache), args); err != nil { return utils.APIErrorHandler(err)