blob: 1c54a02500adc21721b8fd8fca10d5b90b63bd21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package config
import (
"gitlab.com/gitlab-org/gitaly/v14/internal/middleware/limithandler"
)
// ConfigureConcurrencyLimits configures the per-repo, per RPC rate limits
func ConfigureConcurrencyLimits(cfg Cfg) {
maxConcurrencyPerRepoPerRPC := make(map[string]int)
for _, v := range cfg.Concurrency {
maxConcurrencyPerRepoPerRPC[v.RPC] = v.MaxPerRepo
}
// Set default for ReplicateRepository
replicateRepositoryFullMethod := "/gitaly.RepositoryService/ReplicateRepository"
if _, ok := maxConcurrencyPerRepoPerRPC[replicateRepositoryFullMethod]; !ok {
maxConcurrencyPerRepoPerRPC[replicateRepositoryFullMethod] = 1
}
limithandler.SetMaxRepoConcurrency(maxConcurrencyPerRepoPerRPC)
}
|