diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-30 18:10:44 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-30 18:10:44 +0300 |
commit | 412fe7ab5511ec446f250d415d571108fe838b68 (patch) | |
tree | 7070a49951bfb83ee22e963dc0c9a0a884900f29 /lib/gitlab/gitaly_client | |
parent | 7cf8c080eda823e7e2577eeed1f96e168c37ee8f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/gitaly_client')
-rw-r--r-- | lib/gitlab/gitaly_client/repository_service.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/gitlab/gitaly_client/repository_service.rb b/lib/gitlab/gitaly_client/repository_service.rb index 203854264ce..bcc03ca08c9 100644 --- a/lib/gitlab/gitaly_client/repository_service.rb +++ b/lib/gitlab/gitaly_client/repository_service.rb @@ -24,8 +24,20 @@ module Gitlab response.exists end - def optimize_repository - request = Gitaly::OptimizeRepositoryRequest.new(repository: @gitaly_repo) + # Optimize the repository. By default, this will perform heuristical housekeeping in the repository, which + # is the recommended approach and will only optimize what needs to be optimized. If `eager = true`, then + # Gitaly will instead be asked to perform eager housekeeping. As a consequence the housekeeping run will take a + # _lot_ longer. It is not recommended to use eager housekeeping in general, but only in situations where it is + # explicitly required. + def optimize_repository(eager: false) + strategy = if eager + Gitaly::OptimizeRepositoryRequest::Strategy::STRATEGY_EAGER + else + Gitaly::OptimizeRepositoryRequest::Strategy::STRATEGY_HEURISTICAL + end + + request = Gitaly::OptimizeRepositoryRequest.new(repository: @gitaly_repo, + strategy: strategy) gitaly_client_call(@storage, :repository_service, :optimize_repository, request, timeout: GitalyClient.long_timeout) end |