Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Koller <mkoller@gitlab.com>2019-07-15 20:59:57 +0300
committerMarkus Koller <mkoller@gitlab.com>2019-08-12 23:01:15 +0300
commit49c83155ccb78284b17a9ffa47583ddace5dbd01 (patch)
treef9b5697ef11d581737d07b395f529ef3d20e1325 /lib/gitlab/snippet_search_results.rb
parent71ec793214dd81701b5485aa10e20c9719cb0584 (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/snippet_search_results.rb')
-rw-r--r--lib/gitlab/snippet_search_results.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/gitlab/snippet_search_results.rb b/lib/gitlab/snippet_search_results.rb
index e360b552f89..ac3b219e0c7 100644
--- a/lib/gitlab/snippet_search_results.rb
+++ b/lib/gitlab/snippet_search_results.rb
@@ -22,6 +22,17 @@ module Gitlab
end
end
+ def formatted_count(scope)
+ case scope
+ when 'snippet_titles'
+ snippet_titles_count.to_s
+ when 'snippet_blobs'
+ snippet_blobs_count.to_s
+ else
+ super
+ end
+ end
+
def snippet_titles_count
@snippet_titles_count ||= snippet_titles.count
end