From 9dcf74065c8a02c465d71786f65875dd12524baa Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Sun, 10 Oct 2021 12:13:22 +0200 Subject: [PATCH] Rename variable --- internal/httputil/rate_limiting.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/httputil/rate_limiting.go b/internal/httputil/rate_limiting.go index db8d92f4b..c4f47c7b5 100644 --- a/internal/httputil/rate_limiting.go +++ b/internal/httputil/rate_limiting.go @@ -74,23 +74,23 @@ func (l *RateLimits) Limit(req *http.Request) *util.JSONResponse { // Look up the caller's channel, if they have one. l.limitsMutex.RLock() - RateLimit, ok := l.limits[caller] + rateLimit, ok := l.limits[caller] l.limitsMutex.RUnlock() // If the caller doesn't have a channel, create one and write it // back to the map. if !ok { - RateLimit = make(chan struct{}, l.requestThreshold) + rateLimit = make(chan struct{}, l.requestThreshold) l.limitsMutex.Lock() - l.limits[caller] = RateLimit + l.limits[caller] = rateLimit l.limitsMutex.Unlock() } // Check if the user has got free resource slots for this request. // If they don't then we'll return an error. select { - case RateLimit <- struct{}{}: + case rateLimit <- struct{}{}: default: // We hit the rate limit. Tell the client to back off. return &util.JSONResponse{ @@ -103,7 +103,7 @@ func (l *RateLimits) Limit(req *http.Request) *util.JSONResponse { // channel. This will free up space in the channel for new requests. go func() { <-time.After(l.cooloffDuration) - <-RateLimit + <-rateLimit }() return nil }