diff options
author | Stan Hu <stanhu@gmail.com> | 2018-07-21 23:48:12 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-07-24 15:36:31 -0700 |
commit | c8ff6b7c73ccf42e70f7fd4675dd7f68d03739c1 (patch) | |
tree | 9a12252e2d2b6b1e0ce55df26f63eeed31a3452c /lib | |
parent | c06e2ac888fb5180cdf133df89d03b99eceafa0d (diff) | |
download | gitlab-ce-c8ff6b7c73ccf42e70f7fd4675dd7f68d03739c1.tar.gz |
Use limit parameter to retrieve Wikis from Gitalysh-use-wiki-limit-parameter-gitaly
Without this parameter, every load of a Wiki page will load all the Wiki pages
in the repository for the sidebar. This is a significant performance penalty
that can significant slow the display of all Wiki pages.
Relates to #40101
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/wiki.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client/wiki_service.rb | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/gitlab/git/wiki.rb b/lib/gitlab/git/wiki.rb index 8ee46b59830..9d992be66eb 100644 --- a/lib/gitlab/git/wiki.rb +++ b/lib/gitlab/git/wiki.rb @@ -44,9 +44,9 @@ module Gitlab end end - def pages(limit: nil) + def pages(limit: 0) @repository.wrapped_gitaly_errors do - gitaly_get_all_pages + gitaly_get_all_pages(limit: limit) end end @@ -158,8 +158,8 @@ module Gitlab Gitlab::Git::WikiFile.new(wiki_file) end - def gitaly_get_all_pages - gitaly_wiki_client.get_all_pages.map do |wiki_page, version| + def gitaly_get_all_pages(limit: 0) + gitaly_wiki_client.get_all_pages(limit: limit).map do |wiki_page, version| Gitlab::Git::WikiPage.new(wiki_page, version) end end diff --git a/lib/gitlab/gitaly_client/wiki_service.rb b/lib/gitlab/gitaly_client/wiki_service.rb index 6cb049c1f68..75be7d1f5a0 100644 --- a/lib/gitlab/gitaly_client/wiki_service.rb +++ b/lib/gitlab/gitaly_client/wiki_service.rb @@ -85,8 +85,8 @@ module Gitlab wiki_page_from_iterator(response) end - def get_all_pages - request = Gitaly::WikiGetAllPagesRequest.new(repository: @gitaly_repo) + def get_all_pages(limit: 0) + request = Gitaly::WikiGetAllPagesRequest.new(repository: @gitaly_repo, limit: limit) response = GitalyClient.call(@repository.storage, :wiki_service, :wiki_get_all_pages, request, timeout: GitalyClient.medium_timeout) pages = [] |