diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-14 16:01:23 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2021-12-15 10:15:46 +0300 |
commit | be7617b20bbeb81c1036443c6b176574cc3d3b8f (patch) | |
tree | 8b02eb47a96ddd42269e8424ca2927fbe75936b5 /cmd/gitaly-ssh | |
parent | bbc8ddda6b33ee1afa88b328a5cf53ce7f5d64f0 (diff) |
limithandler: Refactor package to not use global state
The limithandler package uses global variables to both track Prometheus
metrics and to handle its configuration. Especially the latter is really
fragile, where we need to set up state of the limithandler in various
places by calling global functions.
Fix this by making the `LimiterMiddleware` self-contained, where it
hosts all configuration as well as the Prometheus metrics.
Diffstat (limited to 'cmd/gitaly-ssh')
-rw-r--r-- | cmd/gitaly-ssh/auth_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd/gitaly-ssh/auth_test.go b/cmd/gitaly-ssh/auth_test.go index c15901765..3dd82bea1 100644 --- a/cmd/gitaly-ssh/auth_test.go +++ b/cmd/gitaly-ssh/auth_test.go @@ -155,7 +155,7 @@ func runServer(t *testing.T, secure bool, cfg config.Cfg, connectionType string, t, gitlab.MockAllowed, gitlab.MockPreReceive, gitlab.MockPostReceive, ), cfg) gitCmdFactory := git.NewExecCommandFactory(cfg) - limitHandler := limithandler.New(limithandler.LimitConcurrencyByRepo) + limitHandler := limithandler.New(cfg, limithandler.LimitConcurrencyByRepo) diskCache := cache.New(cfg, locator) srv, err := server.New(secure, cfg, testhelper.NewDiscardingLogEntry(t), registry, diskCache, limitHandler) require.NoError(t, err) |