Skip to content

Commit aee23f9

Browse files
author
Alexey Vekshin
committed
check for timeout in limiter, fix typo
1 parent eaf17e1 commit aee23f9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

internal/client/ratelimittransport.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ type rateLimitedHTTPTransport struct {
1212
}
1313

1414
func (t *rateLimitedHTTPTransport) RoundTrip(req *http.Request) (*http.Response, error) {
15-
t.limiter.WaitCtx(req.Context())
15+
if err := t.limiter.WaitCtx(req.Context()); err != nil {
16+
return nil, err
17+
}
1618
return t.next.RoundTrip(req)
1719
}

libs/ratelimiter/window.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
// fixed winow rate limiter: limit number of request allowed per time interval
1111
// - keeps track of interval start and last call time
12-
// - on aquire:
12+
// - on acquire:
1313
// - if last call was > interval length ago, refill bucket
1414
// - if there are tokens available, spend one and return immediately
1515
// - if not, wait until the end of interval, refill and spend one

0 commit comments

Comments
 (0)