diff options
author | James Liu <jliu@gitlab.com> | 2023-09-25 05:12:06 +0300 |
---|---|---|
committer | James Liu <jliu@gitlab.com> | 2023-09-25 07:33:22 +0300 |
commit | 6ba2c199039c7c459408d553a9201e9a6ea5e2cb (patch) | |
tree | 08f40ff468ab3c357a29c8eded5876e7a29d0f85 | |
parent | ee8d08fc854366458cdb884f7e94ef52d16b0f6b (diff) |
gitaly/config: Replace hardcoded timeouts with cfgjliu-negotiation-timeouts
Replaces the previous hardcoded timeouts for `git-upload-pack` and
`git-upload-archive` with values pulled from the TOML configuration. If
no values were provided by the user, default values are set in the `Cfg`
struct.
-rw-r--r-- | internal/gitaly/service/ssh/server.go | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/internal/gitaly/service/ssh/server.go b/internal/gitaly/service/ssh/server.go index c0dd3513a..342fb5627 100644 --- a/internal/gitaly/service/ssh/server.go +++ b/internal/gitaly/service/ssh/server.go @@ -12,11 +12,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb" ) -var ( - defaultUploadPackRequestTimeout = 10 * time.Minute - defaultUploadArchiveRequestTimeout = time.Minute -) - type server struct { gitalypb.UnimplementedSSHServiceServer locator storage.Locator @@ -34,10 +29,10 @@ func NewServer(deps *service.Dependencies, serverOpts ...ServerOpt) gitalypb.SSH gitCmdFactory: deps.GetGitCmdFactory(), txManager: deps.GetTxManager(), uploadPackRequestTimeoutTickerFactory: func() helper.Ticker { - return helper.NewTimerTicker(defaultUploadPackRequestTimeout) + return helper.NewTimerTicker(time.Duration(deps.Cfg.Timeout.UploadPack) * time.Minute) }, uploadArchiveRequestTimeoutTickerFactory: func() helper.Ticker { - return helper.NewTimerTicker(defaultUploadArchiveRequestTimeout) + return helper.NewTimerTicker(time.Duration(deps.Cfg.Timeout.UploadArchive) * time.Minute) }, packfileNegotiationMetrics: prometheus.NewCounterVec( prometheus.CounterOpts{}, |