Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
Revert optimization that won't work.
Browse files Browse the repository at this point in the history
  • Loading branch information
Baliedge committed Mar 13, 2024
1 parent 5ce3bc1 commit 0b2adf6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions algorithms.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,18 @@ func tokenBucket(ctx context.Context, s Store, c Cache, r *RateLimitReq, reqStat
rl.ResetTime = expire
}

// Client is only interested in retrieving the current status or
// updating the rate limit config.
if r.Hits == 0 {
return rl, nil
}

if s != nil && reqState.IsOwner {
defer func() {
s.OnChange(ctx, r, item)
}()
}

// Client is only interested in retrieving the current status or
// updating the rate limit config.
if r.Hits == 0 {
return rl, nil
}

// If we are already at the limit.
if rl.Remaining == 0 && r.Hits > 0 {
trace.SpanFromContext(ctx).AddEvent("Already over the limit")
Expand Down

0 comments on commit 0b2adf6

Please sign in to comment.