mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Optimise caching_delay
This commit is contained in:
@@ -338,8 +338,8 @@ func (apierSv1 *APIerSv1) LoadRatingProfile(ctx *context.Context, attrs *utils.T
|
||||
// delay if needed before cache reload
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<LoadRatingProfile> Delaying cache reload for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
if err = dbReader.ReloadCache(config.CgrConfig().GeneralCfg().DefaultCaching, true, make(map[string]any), attrs.Tenant); err != nil {
|
||||
return utils.NewErrServerError(err)
|
||||
}
|
||||
@@ -415,8 +415,8 @@ func (apierSv1 *APIerSv1) LoadTariffPlanFromStorDb(ctx *context.Context, attrs *
|
||||
// delay if needed before cache reload
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<LoadTariffPlanFromStorDb> Delaying cache reload for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
// reload cache
|
||||
utils.Logger.Info("APIerSv1.LoadTariffPlanFromStorDb, reloading cache.")
|
||||
if err := dbReader.ReloadCache(caching, true, attrs.APIOpts, apierSv1.Config.GeneralCfg().DefaultTenant); err != nil {
|
||||
@@ -519,8 +519,8 @@ func (apierSv1 *APIerSv1) SetRatingProfile(ctx *context.Context, attrs *utils.At
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<SetRatingProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(attrs.APIOpts[utils.CacheOpt]), attrs.Tenant, utils.CacheRatingProfiles, keyID, utils.EmptyString, nil, nil, attrs.APIOpts); err != nil {
|
||||
return utils.APIErrorHandler(err)
|
||||
}
|
||||
@@ -1107,8 +1107,8 @@ func (apierSv1 *APIerSv1) LoadTariffPlanFromFolder(ctx *context.Context, attrs *
|
||||
// delay if needed before cache reload
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<V1LoadTariffPlanFromFolder> Delaying cache reload for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
// reload cache
|
||||
utils.Logger.Info("APIerSv1.LoadTariffPlanFromFolder, reloading cache.")
|
||||
if err := loader.ReloadCache(caching, true, attrs.APIOpts, apierSv1.Config.GeneralCfg().DefaultTenant); err != nil {
|
||||
@@ -1184,8 +1184,8 @@ func (apierSv1 *APIerSv1) RemoveTPFromFolder(ctx *context.Context, attrs *utils.
|
||||
// delay if needed before cache reload
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<RemoveTPFromFolder> Delaying cache reload for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
// reload cache
|
||||
utils.Logger.Info("APIerSv1.RemoveTPFromFolder, reloading cache.")
|
||||
if err := loader.ReloadCache(caching, true, attrs.APIOpts, apierSv1.Config.GeneralCfg().DefaultTenant); err != nil {
|
||||
@@ -1241,8 +1241,8 @@ func (apierSv1 *APIerSv1) RemoveTPFromStorDB(ctx *context.Context, attrs *AttrLo
|
||||
// delay if needed before cache reload
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<RemoveTPFromStorDB> Delaying cache reload for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
// reload cache
|
||||
utils.Logger.Info("APIerSv1.RemoveTPFromStorDB, reloading cache.")
|
||||
if err := dbReader.ReloadCache(caching, true, attrs.APIOpts, apierSv1.Config.GeneralCfg().DefaultTenant); err != nil {
|
||||
@@ -1309,8 +1309,8 @@ func (apierSv1 *APIerSv1) RemoveRatingProfile(ctx *context.Context, attr *AttrRe
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<RemoveRatingProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(attr.APIOpts[utils.CacheOpt]), attr.Tenant, utils.CacheRatingProfiles, keyID, utils.EmptyString, nil, nil, attr.APIOpts); err != nil {
|
||||
return utils.APIErrorHandler(err)
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ func (apierSv1 *APIerSv1) SetAttributeProfile(ctx *context.Context, alsWrp *engi
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<SetAttributeProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(alsWrp.APIOpts[utils.CacheOpt]), alsWrp.Tenant, utils.CacheAttributeProfiles,
|
||||
alsWrp.TenantID(), utils.EmptyString, &alsWrp.FilterIDs, alsWrp.Contexts, alsWrp.APIOpts); err != nil {
|
||||
return utils.APIErrorHandler(err)
|
||||
@@ -148,8 +148,8 @@ func (apierSv1 *APIerSv1) RemoveAttributeProfile(ctx *context.Context, arg *util
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<RemoveAttributeProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(arg.APIOpts[utils.CacheOpt]), tnt, utils.CacheAttributeProfiles,
|
||||
utils.ConcatenatedKey(tnt, arg.ID), utils.EmptyString, nil, nil, arg.APIOpts); err != nil {
|
||||
return utils.APIErrorHandler(err)
|
||||
|
||||
@@ -89,8 +89,8 @@ func (apierSv1 *APIerSv1) SetChargerProfile(ctx *context.Context, arg *ChargerWi
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<SetChargerProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
//handle caching for ChargerProfile
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(arg.APIOpts[utils.CacheOpt]), arg.Tenant, utils.CacheChargerProfiles,
|
||||
arg.TenantID(), utils.EmptyString, &arg.FilterIDs, nil, arg.APIOpts); err != nil {
|
||||
@@ -120,8 +120,8 @@ func (apierSv1 *APIerSv1) RemoveChargerProfile(ctx *context.Context, arg *utils.
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<RemoveChargerProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
//handle caching for ChargerProfile
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(arg.APIOpts[utils.CacheOpt]), tnt, utils.CacheChargerProfiles,
|
||||
utils.ConcatenatedKey(tnt, arg.ID), utils.EmptyString, nil, nil, arg.APIOpts); err != nil {
|
||||
|
||||
@@ -93,8 +93,8 @@ func (apierSv1 *APIerSv1) SetDispatcherProfile(ctx *context.Context, args *Dispa
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<SetDispatcherProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
//handle caching for DispatcherProfile
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]), args.Tenant, utils.CacheDispatcherProfiles,
|
||||
args.TenantID(), utils.EmptyString, &args.FilterIDs, args.Subsystems, args.APIOpts); err != nil {
|
||||
@@ -136,8 +136,8 @@ func (apierSv1 *APIerSv1) RemoveDispatcherProfile(ctx *context.Context, arg *uti
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<RemoveDispatcherProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
//handle caching for DispatcherProfile
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(arg.APIOpts[utils.CacheOpt]), tnt, utils.CacheDispatcherProfiles,
|
||||
utils.ConcatenatedKey(tnt, arg.ID), utils.EmptyString, nil, nil, arg.APIOpts); err != nil {
|
||||
|
||||
@@ -380,8 +380,8 @@ func (rplSv1 *ReplicatorSv1) SetThresholdProfile(ctx *context.Context, th *engin
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1SetThresholdProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(th.APIOpts[utils.CacheOpt]),
|
||||
th.Tenant, utils.CacheThresholdProfiles, th.TenantID(), utils.EmptyString, &th.FilterIDs, nil, th.APIOpts); err != nil {
|
||||
return
|
||||
@@ -411,8 +411,8 @@ func (rplSv1 *ReplicatorSv1) SetStatQueueProfile(ctx *context.Context, sq *engin
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1SetStatQueueProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(sq.APIOpts[utils.CacheOpt]),
|
||||
sq.Tenant, utils.CacheStatQueueProfiles, sq.TenantID(), utils.EmptyString, &sq.FilterIDs, nil, sq.APIOpts); err != nil {
|
||||
return
|
||||
@@ -468,8 +468,8 @@ func (rplSv1 *ReplicatorSv1) SetResourceProfile(ctx *context.Context, rs *engine
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1SetResourceProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(rs.APIOpts[utils.CacheOpt]),
|
||||
rs.Tenant, utils.CacheResourceProfiles, rs.TenantID(), utils.EmptyString, &rs.FilterIDs, nil, rs.APIOpts); err != nil {
|
||||
return
|
||||
@@ -551,8 +551,8 @@ func (rplSv1 *ReplicatorSv1) SetRatingProfile(ctx *context.Context, rp *engine.R
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1SetRatingProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(rp.APIOpts[utils.CacheOpt]),
|
||||
rp.Tenant, utils.CacheRatingProfiles, rp.Id, utils.EmptyString, nil, nil, rp.APIOpts); err != nil {
|
||||
return
|
||||
@@ -569,8 +569,8 @@ func (rplSv1 *ReplicatorSv1) SetRouteProfile(ctx *context.Context, sp *engine.Ro
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1SetRouteProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(sp.APIOpts[utils.CacheOpt]),
|
||||
sp.Tenant, utils.CacheRouteProfiles, sp.TenantID(), utils.EmptyString, &sp.FilterIDs, nil, sp.APIOpts); err != nil {
|
||||
return
|
||||
@@ -587,8 +587,8 @@ func (rplSv1 *ReplicatorSv1) SetAttributeProfile(ctx *context.Context, ap *engin
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1SetAttributeProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(ap.APIOpts[utils.CacheOpt]),
|
||||
ap.Tenant, utils.CacheAttributeProfiles, ap.TenantID(), utils.EmptyString, &ap.FilterIDs, ap.Contexts, ap.APIOpts); err != nil {
|
||||
return
|
||||
@@ -605,8 +605,8 @@ func (rplSv1 *ReplicatorSv1) SetChargerProfile(ctx *context.Context, cp *engine.
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1SetChargerProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(cp.APIOpts[utils.CacheOpt]),
|
||||
cp.Tenant, utils.CacheChargerProfiles, cp.TenantID(), utils.EmptyString, &cp.FilterIDs, nil, cp.APIOpts); err != nil {
|
||||
return
|
||||
@@ -623,8 +623,8 @@ func (rplSv1 *ReplicatorSv1) SetDispatcherProfile(ctx *context.Context, dpp *eng
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1SetDispatcherProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(dpp.APIOpts[utils.CacheOpt]),
|
||||
dpp.Tenant, utils.CacheDispatcherProfiles, dpp.TenantID(), utils.EmptyString, &dpp.FilterIDs, dpp.Subsystems, dpp.APIOpts); err != nil {
|
||||
return
|
||||
@@ -776,8 +776,8 @@ func (rplSv1 *ReplicatorSv1) RemoveThresholdProfile(ctx *context.Context, args *
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1RemoveThresholdProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]),
|
||||
args.Tenant, utils.CacheThresholdProfiles, args.TenantID.TenantID(), utils.EmptyString, nil, nil, args.APIOpts); err != nil {
|
||||
return
|
||||
@@ -794,8 +794,8 @@ func (rplSv1 *ReplicatorSv1) RemoveStatQueueProfile(ctx *context.Context, args *
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1RemoveStatQueueProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]),
|
||||
args.Tenant, utils.CacheStatQueueProfiles, args.TenantID.TenantID(), utils.EmptyString, nil, nil, args.APIOpts); err != nil {
|
||||
return
|
||||
@@ -838,8 +838,8 @@ func (rplSv1 *ReplicatorSv1) RemoveResourceProfile(ctx *context.Context, args *u
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1RemoveResourceProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]),
|
||||
args.Tenant, utils.CacheResourceProfiles, args.TenantID.TenantID(), utils.EmptyString, nil, nil, args.APIOpts); err != nil {
|
||||
return
|
||||
@@ -934,8 +934,8 @@ func (rplSv1 *ReplicatorSv1) RemoveRatingProfile(ctx *context.Context, id *utils
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1RemoveRatingProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(id.APIOpts[utils.CacheOpt]),
|
||||
id.Tenant, utils.CacheRatingProfiles, id.Arg, utils.EmptyString, nil, nil, id.APIOpts); err != nil {
|
||||
return
|
||||
@@ -952,8 +952,8 @@ func (rplSv1 *ReplicatorSv1) RemoveRouteProfile(ctx *context.Context, args *util
|
||||
// delay if needed before cache call
|
||||
if rplSv1.v1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<ReplicatorSv1RemoveRouteProfile> Delaying cache call for %v", rplSv1.v1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(rplSv1.v1.Config.GeneralCfg().CachingDelay)
|
||||
if err = rplSv1.v1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]),
|
||||
args.Tenant, utils.CacheRouteProfiles, args.TenantID.TenantID(), utils.EmptyString, nil, nil, args.APIOpts); err != nil {
|
||||
return
|
||||
|
||||
@@ -131,8 +131,8 @@ func (apierSv1 *APIerSv1) SetResourceProfile(ctx *context.Context, arg *engine.R
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<SetResourceProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
//handle caching for ResourceProfile
|
||||
if err = apierSv1.CallCache(utils.IfaceAsString(arg.APIOpts[utils.CacheOpt]), arg.Tenant, utils.CacheResourceProfiles,
|
||||
arg.TenantID(), utils.EmptyString, &arg.FilterIDs, nil, arg.APIOpts); err != nil {
|
||||
@@ -157,8 +157,8 @@ func (apierSv1 *APIerSv1) RemoveResourceProfile(ctx *context.Context, arg *utils
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<RemoveResourceProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
//handle caching for ResourceProfile
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(arg.APIOpts[utils.CacheOpt]), tnt, utils.CacheResourceProfiles,
|
||||
utils.ConcatenatedKey(tnt, arg.ID), utils.EmptyString, nil, nil, arg.APIOpts); err != nil {
|
||||
|
||||
@@ -89,8 +89,8 @@ func (apierSv1 *APIerSv1) SetRouteProfile(ctx *context.Context, args *RouteWithA
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<SetRouteProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
//handle caching for SupplierProfile
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]), args.Tenant, utils.CacheRouteProfiles,
|
||||
args.TenantID(), utils.EmptyString, &args.FilterIDs, nil, args.APIOpts); err != nil {
|
||||
@@ -119,8 +119,8 @@ func (apierSv1 *APIerSv1) RemoveRouteProfile(ctx *context.Context, args *utils.T
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<RemoveRouteProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
//handle caching for SupplierProfile
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]), tnt, utils.CacheRouteProfiles,
|
||||
utils.ConcatenatedKey(tnt, args.ID), utils.EmptyString, nil, nil, args.APIOpts); err != nil {
|
||||
|
||||
@@ -87,8 +87,8 @@ func (apierSv1 *APIerSv1) SetStatQueueProfile(ctx *context.Context, arg *engine.
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<SetStatQueueProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
//handle caching for StatQueueProfile
|
||||
if err = apierSv1.CallCache(utils.IfaceAsString(arg.APIOpts[utils.CacheOpt]), arg.Tenant, utils.CacheStatQueueProfiles,
|
||||
arg.TenantID(), utils.EmptyString, &arg.FilterIDs, nil, arg.APIOpts); err != nil {
|
||||
@@ -113,8 +113,8 @@ func (apierSv1 *APIerSv1) RemoveStatQueueProfile(ctx *context.Context, args *uti
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<RemoveStatQueueProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
//handle caching for StatQueueProfile
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]), tnt, utils.CacheStatQueueProfiles,
|
||||
utils.ConcatenatedKey(tnt, args.ID), utils.EmptyString, nil, nil, args.APIOpts); err != nil {
|
||||
|
||||
@@ -145,8 +145,8 @@ func (apierSv1 *APIerSv1) SetThresholdProfile(ctx *context.Context, args *engine
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<SetThresholdProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
//handle caching for ThresholdProfile and Threshold
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]), args.Tenant, utils.CacheThresholdProfiles,
|
||||
args.TenantID(), utils.EmptyString, &args.FilterIDs, nil, args.APIOpts); err != nil {
|
||||
@@ -171,8 +171,8 @@ func (apierSv1 *APIerSv1) RemoveThresholdProfile(ctx *context.Context, args *uti
|
||||
// delay if needed before cache call
|
||||
if apierSv1.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<RemoveThresholdProfile> Delaying cache call for %v", apierSv1.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apierSv1.Config.GeneralCfg().CachingDelay)
|
||||
//handle caching for ThresholdProfile
|
||||
if err := apierSv1.CallCache(utils.IfaceAsString(args.APIOpts[utils.CacheOpt]), tnt, utils.CacheThresholdProfiles,
|
||||
utils.ConcatenatedKey(tnt, args.ID), utils.EmptyString, nil, nil, args.APIOpts); err != nil {
|
||||
|
||||
@@ -71,8 +71,8 @@ func (apiv2 *APIerSv2) LoadRatingProfile(ctx *context.Context, attrs *AttrLoadRa
|
||||
// delay if needed before cache reload
|
||||
if apiv2.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<V2LoadRatingProfile>Delaying cache reload for %v", apiv2.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apiv2.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apiv2.Config.GeneralCfg().CachingDelay)
|
||||
if err = dbReader.ReloadCache(config.CgrConfig().GeneralCfg().DefaultCaching, true, make(map[string]any), apiv2.Config.GeneralCfg().DefaultTenant); err != nil {
|
||||
return utils.NewErrServerError(err)
|
||||
}
|
||||
@@ -165,8 +165,8 @@ func (apiv2 *APIerSv2) LoadTariffPlanFromFolder(ctx *context.Context, attrs *uti
|
||||
// delay if needed before cache reload
|
||||
if apiv2.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<V2LoadTariffPlanFromFolder> Delaying cache reload for %v", apiv2.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(apiv2.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(apiv2.Config.GeneralCfg().CachingDelay)
|
||||
if err := loader.ReloadCache(caching, true, attrs.APIOpts, apiv2.Config.GeneralCfg().DefaultTimezone); err != nil {
|
||||
return utils.NewErrServerError(err)
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@ func (APIerSv2 *APIerSv2) SetAttributeProfile(ctx *context.Context, arg *Attribu
|
||||
// delay if needed before cache call
|
||||
if APIerSv2.Config.GeneralCfg().CachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<V2SetAttributeProfile> Delaying cache call for %v", APIerSv2.Config.GeneralCfg().CachingDelay))
|
||||
time.Sleep(APIerSv2.Config.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(APIerSv2.Config.GeneralCfg().CachingDelay)
|
||||
if err := APIerSv2.APIerSv1.CallCache(utils.IfaceAsString(arg.APIOpts[utils.CacheOpt]), alsPrf.Tenant, utils.CacheAttributeProfiles,
|
||||
alsPrf.TenantID(), utils.EmptyString, &alsPrf.FilterIDs, alsPrf.Contexts, arg.APIOpts); err != nil {
|
||||
return utils.APIErrorHandler(err)
|
||||
|
||||
@@ -417,8 +417,8 @@ func main() {
|
||||
// delay if needed before cache reload
|
||||
if *verbose && ldrCfg.GeneralCfg().CachingDelay != 0 {
|
||||
log.Printf("Delaying cache reload for %v", ldrCfg.GeneralCfg().CachingDelay)
|
||||
time.Sleep(ldrCfg.GeneralCfg().CachingDelay)
|
||||
}
|
||||
time.Sleep(ldrCfg.GeneralCfg().CachingDelay)
|
||||
|
||||
// reload cache
|
||||
if err = tpReader.ReloadCache(ldrCfg.GeneralCfg().DefaultCaching, *verbose, map[string]any{
|
||||
|
||||
@@ -560,8 +560,8 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
// delay if needed before cache reload
|
||||
if ldr.cachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<%v> Delaying cache reload for %v", utils.LoaderS, ldr.cachingDelay))
|
||||
time.Sleep(ldr.cachingDelay)
|
||||
}
|
||||
time.Sleep(ldr.cachingDelay)
|
||||
if len(ldr.cacheConns) != 0 {
|
||||
return engine.CallCache(ldr.connMgr, ldr.cacheConns, caching, cacheArgs, cacheIDs, nil, false, ldr.tenant)
|
||||
}
|
||||
@@ -811,8 +811,8 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa
|
||||
// delay if needed before cache reload
|
||||
if ldr.cachingDelay != 0 {
|
||||
utils.Logger.Info(fmt.Sprintf("<%v> Delaying cache reload for %v", utils.LoaderS, ldr.cachingDelay))
|
||||
time.Sleep(ldr.cachingDelay)
|
||||
}
|
||||
time.Sleep(ldr.cachingDelay)
|
||||
if len(ldr.cacheConns) != 0 {
|
||||
return engine.CallCache(ldr.connMgr, ldr.cacheConns, caching, cacheArgs, cacheIDs, nil, false, ldr.tenant)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user