Dispatchers and cache

This commit is contained in:
adi
2022-10-05 17:03:17 +03:00
committed by Dan Christian Bogos
parent 7267219789
commit f3b4390838
3 changed files with 10 additions and 1 deletions

View File

@@ -137,6 +137,11 @@ func (admS *AdminSv1) SetDispatcherProfile(ctx *context.Context, args *Dispatche
args.TenantID(), &args.FilterIDs, args.APIOpts); err != nil {
return utils.APIErrorHandler(err)
}
//handle caching for DispatcherProfile
if err := admS.CallCache(ctx, utils.IfaceAsString(args.APIOpts[utils.MetaCache]), args.Tenant, utils.CacheDispatcherProfiles,
args.TenantID(), &args.FilterIDs, args.APIOpts); err != nil {
return utils.APIErrorHandler(err)
}
*reply = utils.OK
return nil
}

View File

@@ -207,7 +207,7 @@ func (chS *CacheS) GetWithRemote(ctx *context.Context, args *utils.ArgsGetCacheI
}
if len(chS.cfg.CacheCfg().RemoteConns) == 0 ||
!chS.cfg.CacheCfg().Partitions[args.CacheID].Remote {
return nil, fmt.Errorf("Remote connections are missing from Cache config or Remote field of partition: %s is false", args.CacheID)
return nil, utils.ErrNotFound
}
// item was not found locally, query from remote
if err = chS.connMgr.Call(ctx, chS.cfg.CacheCfg().RemoteConns,

View File

@@ -463,6 +463,8 @@ func NewAttrReloadCacheWithOptsFromMap(arg map[string][]string, tnt string, opts
ChargerProfileIDs: arg[CacheChargerProfiles],
DispatcherProfileIDs: arg[CacheDispatcherProfiles],
DispatcherHostIDs: arg[CacheDispatcherHosts],
Dispatchers: arg[CacheDispatchers],
DispatcherRoutes: arg[CacheDispatcherRoutes],
RateProfileIDs: arg[CacheRateProfiles],
ActionProfileIDs: arg[CacheActionProfiles],
AccountIDs: arg[CacheAccounts],
@@ -497,6 +499,8 @@ type AttrReloadCacheWithAPIOpts struct {
ChargerProfileIDs []string `json:",omitempty"`
DispatcherProfileIDs []string `json:",omitempty"`
DispatcherHostIDs []string `json:",omitempty"`
Dispatchers []string `json:",omitempty"`
DispatcherRoutes []string `json:",omitempty"`
RateProfileIDs []string `json:",omitempty"`
ActionProfileIDs []string `json:",omitempty"`
AccountIDs []string `json:",omitempty"`