Skip to content

Commit ef7cafd

Browse files
use ctx
1 parent 8b9e3a8 commit ef7cafd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

management/server/http/middleware/rate_limiter.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package middleware
22

33
import (
4+
"context"
45
"sync"
56
"time"
67

@@ -68,9 +69,9 @@ func (rl *APIRateLimiter) Allow(key string) bool {
6869

6970
// Wait blocks until the rate limiter allows another request for the given key
7071
// Returns an error if the context is canceled
71-
func (rl *APIRateLimiter) Wait(key string) error {
72+
func (rl *APIRateLimiter) Wait(ctx context.Context, key string) error {
7273
limiter := rl.getLimiter(key)
73-
return limiter.Wait(nil)
74+
return limiter.Wait(ctx)
7475
}
7576

7677
// getLimiter retrieves or creates a rate limiter for the given key

0 commit comments

Comments
 (0)