diff options
author | Markus Koller <mkoller@gitlab.com> | 2019-07-15 20:59:57 +0300 |
---|---|---|
committer | Markus Koller <mkoller@gitlab.com> | 2019-08-12 23:01:15 +0300 |
commit | 49c83155ccb78284b17a9ffa47583ddace5dbd01 (patch) | |
tree | f9b5697ef11d581737d07b395f529ef3d20e1325 /lib/gitlab/project_search_results.rb | |
parent | 71ec793214dd81701b5485aa10e20c9719cb0584 (diff) |
Load search result counts asynchronously
Querying all counts for the different search results in the same request
led to timeouts, so we now only calculate the count for the *current*
search results, and request the others in separate asynchronous calls.
Diffstat (limited to 'lib/gitlab/project_search_results.rb')
-rw-r--r-- | lib/gitlab/project_search_results.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/gitlab/project_search_results.rb b/lib/gitlab/project_search_results.rb index 5e77d31760d..2669adb8455 100644 --- a/lib/gitlab/project_search_results.rb +++ b/lib/gitlab/project_search_results.rb @@ -29,6 +29,21 @@ module Gitlab end end + def formatted_count(scope) + case scope + when 'blobs' + blobs_count.to_s + when 'notes' + formatted_limited_count(limited_notes_count) + when 'wiki_blobs' + wiki_blobs_count.to_s + when 'commits' + commits_count.to_s + else + super + end + end + def users super.where(id: @project.team.members) # rubocop:disable CodeReuse/ActiveRecord end |