Skip to content

Commit

Permalink
Make public the syncronisation between redis and the source of truth …
Browse files Browse the repository at this point in the history
…for a limit
  • Loading branch information
jgough committed Oct 11, 2024
1 parent a56a9d4 commit e347cac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion redis/count_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions redis/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit e347cac

Please sign in to comment.