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:
authorQuang-Minh Nguyen <qmnguyen@gitlab.com>2023-09-28 06:40:56 +0300
committerQuang-Minh Nguyen <qmnguyen@gitlab.com>2023-09-28 06:40:56 +0300
commitb87e16084b871680a4338530e6efa315b18de94a (patch)
treec94293d8eae2e67aa37b10856642bfa5c908e95b /internal/cli/gitaly
parente71de95f649e3f260aa3b775365a2abf9250d05f (diff)
limiter: Let limithandler.WithConcurrencyLimiters return created limits
limithandler.WithConcurrencyLimiters returns a function to setup per-RPC concurrency limiter. This function is called when Gitaly process creates a limiter interceptor. It creates a lot of things and notably adaptive limit structs. Currenty, those limits are not connected to the adaptive calculator. In some later commits, we need to pull those limits out and plug into the calculator so that the calculator can adjust those limits. This commit adjusts the signature of that function and let it return the configured limits.
Diffstat (limited to 'internal/cli/gitaly')
-rw-r--r--internal/cli/gitaly/serve.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/cli/gitaly/serve.go b/internal/cli/gitaly/serve.go
index 66d8cbeb3..e436c7d48 100644
--- a/internal/cli/gitaly/serve.go
+++ b/internal/cli/gitaly/serve.go
@@ -298,12 +298,13 @@ func run(cfg config.Cfg, logger log.Logger) error {
adaptiveLimits := []limiter.AdaptiveLimiter{}
- concurrencyLimitHandler := limithandler.New(
+ _, setupPerRPCConcurrencyLimiters := limithandler.WithConcurrencyLimiters(cfg)
+ perRPCLimitHandler := limithandler.New(
cfg,
limithandler.LimitConcurrencyByRepo,
- limithandler.WithConcurrencyLimiters,
+ setupPerRPCConcurrencyLimiters,
)
- prometheus.MustRegister(concurrencyLimitHandler)
+ prometheus.MustRegister(perRPCLimitHandler)
rateLimitHandler := limithandler.New(
cfg,
@@ -363,7 +364,7 @@ func run(cfg config.Cfg, logger log.Logger) error {
logger,
registry,
diskCache,
- []*limithandler.LimiterMiddleware{concurrencyLimitHandler, rateLimitHandler},
+ []*limithandler.LimiterMiddleware{perRPCLimitHandler, rateLimitHandler},
)
defer gitalyServerFactory.Stop()