Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'internal/middleware')
-rw-r--r--internal/middleware/limithandler/concurrency_limiter.go2
-rw-r--r--internal/middleware/limithandler/middleware_test.go3
-rw-r--r--internal/middleware/limithandler/rate_limiter.go2
3 files changed, 4 insertions, 3 deletions
diff --git a/internal/middleware/limithandler/concurrency_limiter.go b/internal/middleware/limithandler/concurrency_limiter.go
index cf552917d..e2595571b 100644
--- a/internal/middleware/limithandler/concurrency_limiter.go
+++ b/internal/middleware/limithandler/concurrency_limiter.go
@@ -276,7 +276,7 @@ func WithConcurrencyLimiters(cfg config.Cfg, middleware *LimiterMiddleware) {
if limit.MaxQueueWait > 0 {
limit := limit
newTickerFunc = func() helper.Ticker {
- return helper.NewTimerTicker(limit.MaxQueueWait)
+ return helper.NewTimerTicker(limit.MaxQueueWait.Duration())
}
}
diff --git a/internal/middleware/limithandler/middleware_test.go b/internal/middleware/limithandler/middleware_test.go
index 9a2fb9870..d5aa4ee57 100644
--- a/internal/middleware/limithandler/middleware_test.go
+++ b/internal/middleware/limithandler/middleware_test.go
@@ -16,6 +16,7 @@ import (
"github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitaly/v15/internal/gitaly/config"
"gitlab.com/gitlab-org/gitaly/v15/internal/helper"
+ "gitlab.com/gitlab-org/gitaly/v15/internal/helper/duration"
"gitlab.com/gitlab-org/gitaly/v15/internal/middleware/limithandler"
pb "gitlab.com/gitlab-org/gitaly/v15/internal/middleware/limithandler/testdata"
"gitlab.com/gitlab-org/gitaly/v15/internal/testhelper"
@@ -487,7 +488,7 @@ func TestRateLimitHandler(t *testing.T) {
methodName := "/test.limithandler.Test/Unary"
cfg := config.Cfg{
RateLimiting: []config.RateLimiting{
- {RPC: methodName, Interval: 1 * time.Hour, Burst: 1},
+ {RPC: methodName, Interval: duration.Duration(1 * time.Hour), Burst: 1},
},
}
diff --git a/internal/middleware/limithandler/rate_limiter.go b/internal/middleware/limithandler/rate_limiter.go
index 89f6deeab..5f2f2d9f6 100644
--- a/internal/middleware/limithandler/rate_limiter.go
+++ b/internal/middleware/limithandler/rate_limiter.go
@@ -119,7 +119,7 @@ func WithRateLimiters(ctx context.Context) SetupFunc {
if limitCfg.Burst > 0 && limitCfg.Interval > 0 {
serviceName, methodName := splitMethodName(limitCfg.RPC)
rateLimiter := NewRateLimiter(
- limitCfg.Interval,
+ limitCfg.Interval.Duration(),
limitCfg.Burst,
helper.NewTimerTicker(5*time.Minute),
middleware.requestsDroppedMetric.With(prometheus.Labels{