From be89e02994c5333da3e946dfade957e726585336 Mon Sep 17 00:00:00 2001 From: jgough Date: Fri, 11 Oct 2024 08:12:55 +0100 Subject: [PATCH] Make public the syncronisation between redis and the source of truth for a limit re: AB#10021 --- redis/count_resource.go | 2 +- redis/resource.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/redis/count_resource.go b/redis/count_resource.go index fcb0113..8ac39ef 100644 --- a/redis/count_resource.go +++ b/redis/count_resource.go @@ -301,7 +301,7 @@ func (cr *CountResource) Available(ctx context.Context, tenantID string) (int64, } // count is now zero so check the actual number of resources and adjust if necessary. - newLimit, err := cr.refreshLimit(ctx, tenantID) + newLimit, err := cr.RefreshLimit(ctx, tenantID) if err != nil { log.Infof("reset count failure: %v", err) newLimit = limit diff --git a/redis/resource.go b/redis/resource.go index 86d8eaa..c9ab3c3 100644 --- a/redis/resource.go +++ b/redis/resource.go @@ -285,11 +285,11 @@ func (r *Resource) getLimit(ctx context.Context, tenantID string) (int64, error) return limit, nil } // we haven't got the redis limit therefore attempt to retrieve from upstream - return r.refreshLimit(ctx, tenantID) + return r.RefreshLimit(ctx, tenantID) } -// refreshLimit gets the limit for a given tenant from upstream. -func (r *Resource) refreshLimit(ctx context.Context, tenantID string) (int64, error) { +// RefreshLimit gets the limit for a given tenant from upstream. +func (r *Resource) RefreshLimit(ctx context.Context, tenantID string) (int64, error) { log := r.Log().FromContext(ctx) defer log.Close()