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-08-02 05:22:35 +0300
committerQuang-Minh Nguyen <qmnguyen@gitlab.com>2023-08-09 10:58:37 +0300
commit5940027df2950a29a2e4db7216033f382fe52cf1 (patch)
tree0e19e72e75470eb0fdfa4581ee6b32552b85382a /internal/testhelper/testserver/gitaly.go
parent05fe384ca2e9614be5b63b57c696bb237d9792f9 (diff)
limiter: Add context to limithandler.WithConcurrencyLimiters
This commit adds context to limithandler.WithConcurrencyLimiters. This addition makes it align with limithandler.WithRateLimiters's signature. This context is used to control the cancellation of some internal goroutines in some next commits.
Diffstat (limited to 'internal/testhelper/testserver/gitaly.go')
-rw-r--r--internal/testhelper/testserver/gitaly.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/internal/testhelper/testserver/gitaly.go b/internal/testhelper/testserver/gitaly.go
index 8e44b7839..b3322d95b 100644
--- a/internal/testhelper/testserver/gitaly.go
+++ b/internal/testhelper/testserver/gitaly.go
@@ -161,6 +161,8 @@ func waitHealthy(tb testing.TB, ctx context.Context, addr string, authToken stri
func runGitaly(tb testing.TB, cfg config.Cfg, registrar func(srv *grpc.Server, deps *service.Dependencies), opts ...GitalyServerOpt) (*grpc.Server, string, bool) {
tb.Helper()
+ ctx := testhelper.Context(tb)
+
var gsd gitalyServerDeps
for _, opt := range opts {
gsd = opt(gsd)
@@ -173,7 +175,7 @@ func runGitaly(tb testing.TB, cfg config.Cfg, registrar func(srv *grpc.Server, d
server.WithStreamInterceptor(StructErrStreamInterceptor),
}
- deps := gsd.createDependencies(tb, cfg)
+ deps := gsd.createDependencies(ctx, tb, cfg)
tb.Cleanup(func() { gsd.conns.Close() })
serverFactory := server.NewGitalyServerFactory(
@@ -201,7 +203,6 @@ func runGitaly(tb testing.TB, cfg config.Cfg, registrar func(srv *grpc.Server, d
assert.NoError(tb, internalServer.Serve(internalListener), "failure to serve internal gRPC")
}()
- ctx := testhelper.Context(tb)
waitHealthy(tb, ctx, "unix://"+internalListener.Addr().String(), cfg.Auth.Token)
}
@@ -238,7 +239,6 @@ func runGitaly(tb testing.TB, cfg config.Cfg, registrar func(srv *grpc.Server, d
assert.NoError(tb, externalServer.Serve(listener), "failure to serve external gRPC")
}()
- ctx := testhelper.Context(tb)
waitHealthy(tb, ctx, addr, cfg.Auth.Token)
return externalServer, addr, gsd.disablePraefect
@@ -276,7 +276,7 @@ type gitalyServerDeps struct {
signingKey string
}
-func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg) *service.Dependencies {
+func (gsd *gitalyServerDeps) createDependencies(ctx context.Context, tb testing.TB, cfg config.Cfg) *service.Dependencies {
if gsd.logger == nil {
gsd.logger = testhelper.NewGitalyServerLogger(tb)
}
@@ -328,6 +328,7 @@ func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg) *
if gsd.packObjectsLimiter == nil {
gsd.packObjectsLimiter = limiter.NewConcurrencyLimiter(
+ ctx,
0,
0,
nil,
@@ -336,7 +337,7 @@ func (gsd *gitalyServerDeps) createDependencies(tb testing.TB, cfg config.Cfg) *
}
if gsd.limitHandler == nil {
- gsd.limitHandler = limithandler.New(cfg, limithandler.LimitConcurrencyByRepo, limithandler.WithConcurrencyLimiters)
+ gsd.limitHandler = limithandler.New(cfg, limithandler.LimitConcurrencyByRepo, limithandler.WithConcurrencyLimiters(ctx))
}
if gsd.repositoryCounter == nil {