Commit f11a6568 authored by Dylan Griffith's avatar Dylan Griffith

Reduce timeouts on SearchController#count to 5s

The current timeout defaults to 15s. Per
https://gitlab.com/gitlab-org/gitlab/-/issues/327106 this endpoint
consumes a considerable amount of DB time. Since this endpoint is not as
essential as the primary task the user is performing (since it is used
to generate tab counts for other tabs you aren't searching) it makes
sense to reduce the timeout so slower counts don't consume too much
resources.
parent 11c635a8
......@@ -47,7 +47,11 @@ class SearchController < ApplicationController
params.require([:search, :scope])
scope = search_service.scope
count = 0
ApplicationRecord.with_fast_read_statement_timeout do
count = search_service.search_results.formatted_count(scope)
end
# Users switching tabs will keep fetching the same tab counts so it's a
# good idea to cache in their browser just for a short time. They can still
......
---
title: Reduce timeouts on tab counts for searches to 5s
merge_request: 59435
author:
type: performance
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment