Add Advanced Search timeout
What does this MR do and why?
This MR enables the timeout feature for Advanced Search. It was introduced to Basic Search in !65085 (merged).
Screenshots or screen recordings
How to set up and validate locally
Option 1
Since it's pretty hard to cause timeouts in a local elasticsearch cluster I used a tool called Charles. You might need to find an alternative if you're on Linux.
- Enable Advanced Search in GDK if it's not configured
- Set up the proxy tool to capture and rewrite responses from Elasticsearch and replace
"timed_out": false
with"timed_out": true
. I've replaced the entire response for requests that matchedgitlab-development-issues/doc/_search?from=0&size=20&timeout=30s
with{"hits": {"hits": [], "total": {"relation": "gte", "value": 0}, "max_score": null}, "took": 40, "timed_out": true}
- Point your gitlab installation to this proxy tool URL. For example:
bin/rails runner "ApplicationSetting.current.update!(elasticsearch_url: 'http://localhost:54827')"
- Perform issues search
- Ensure that this page has the
Your search timed out
message
Easier option
As a much simpler, but less precise option you can do this:
- Enable Advanced Search in GDK if it's not configured
- Temporarily add this code to
SearchController#show
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index ff52d76527e..e675fcac0cc 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -27,6 +27,7 @@ class SearchController < ApplicationController urgency :high, [:opensearch] def show + raise Elastic::TimeoutError @project = search_service.project @group = search_service.group
- Perform issues search
- Ensure that this page has the
Your search timed out
message
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #338836 (closed)
Edited by Dmitry Gruzd