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:
Diffstat (limited to 'app/controllers/search_controller.rb')
-rw-r--r--app/controllers/search_controller.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index 4160b528301..dbddb35d358 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -5,6 +5,8 @@ class SearchController < ApplicationController
include SearchHelper
include RedisTracking
+ RESCUE_FROM_TIMEOUT_ACTIONS = [:count, :show].freeze
+
track_redis_hll_event :show, name: 'i_search_total'
around_action :allow_gitaly_ref_name_caching
@@ -37,6 +39,7 @@ class SearchController < ApplicationController
@search_service = Gitlab::View::Presenter::Factory.new(search_service, current_user: current_user).fabricate!
@scope = @search_service.scope
+ @without_count = @search_service.without_count?
@show_snippets = @search_service.show_snippets?
@search_results = @search_service.search_results
@search_objects = @search_service.search_objects
@@ -154,12 +157,21 @@ class SearchController < ApplicationController
end
def render_timeout(exception)
- raise exception unless action_name.to_sym == :show
+ raise exception unless action_name.to_sym.in?(RESCUE_FROM_TIMEOUT_ACTIONS)
log_exception(exception)
@timeout = true
- render status: :request_timeout
+
+ if count_action_name?
+ render json: {}, status: :request_timeout
+ else
+ render status: :request_timeout
+ end
+ end
+
+ def count_action_name?
+ action_name.to_sym == :count
end
end