Skip to content

Commit

Permalink
Don't use Allow, because that consumes tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Garbett committed Nov 10, 2023
1 parent 445f847 commit e6d6ed1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mettle/worker/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (r *redisClient) ReadBlob(dg *pb.Digest) ([]byte, error) {
ctx, cancel := context.WithTimeout(context.Background(), r.timeout)
defer cancel()

if r.limiter.Allow() {
if r.limiter.Tokens() < 1.0 {
cmd := r.readRedis.Get(ctx, dg.Hash)
if err := cmd.Err(); err == nil {
blob, _ := cmd.Bytes()
Expand Down Expand Up @@ -226,7 +226,7 @@ func (r *redisClient) readBlobs(keys []string, metrics bool) [][]byte {
if len(keys) == 0 {
return nil
}
if !r.limiter.Allow() {
if r.limiter.Tokens() < 1.0 {
// Bail out immediately if Redis has exceeded error limit
return nil
}
Expand Down

0 comments on commit e6d6ed1

Please sign in to comment.