Skip to content
Snippets Groups Projects
Commit 3a4f3632 authored by Dmitry Gruzd's avatar Dmitry Gruzd
Browse files

Add timeout for gitlab-elasticsearch-indexer

parent bfe2457a
No related branches found
No related tags found
No related merge requests found
2.11.0
2.12.0
Loading
Loading
@@ -25,7 +25,7 @@ def perform(project_id, oldrev = nil, newrev = nil, wiki = false)
project = Project.find(project_id)
return true unless project.use_elasticsearch?
 
in_lock("#{self.class.name}/#{project_id}/#{wiki}", ttl: 1.day, retries: 0) do
in_lock("#{self.class.name}/#{project_id}/#{wiki}", ttl: (Gitlab::Elastic::Indexer::TIMEOUT + 1.minute), retries: 0) do
Gitlab::Elastic::Indexer.new(project, wiki: wiki).run
end
end
Loading
Loading
Loading
Loading
@@ -8,6 +8,8 @@ module Elastic
class Indexer
include Gitlab::Utils::StrongMemoize
 
TIMEOUT = 1.day
Error = Class.new(StandardError)
 
class << self
Loading
Loading
@@ -73,11 +75,13 @@ def run_indexer!(to_sha, target)
vars = build_envvars(base_sha, to_sha, target)
path_to_indexer = Gitlab.config.elasticsearch.indexer_path
 
timeout_argument = "--timeout=#{TIMEOUT.to_i}"
command =
if index_wiki?
[path_to_indexer, "--blob-type=wiki_blob", "--skip-commits", "--project-path=#{project.full_path}", project.id.to_s, repository_path]
[path_to_indexer, timeout_argument, "--blob-type=wiki_blob", "--skip-commits", "--project-path=#{project.full_path}", project.id.to_s, repository_path]
else
[path_to_indexer, "--project-path=#{project.full_path}", project.id.to_s, repository_path]
[path_to_indexer, timeout_argument, "--project-path=#{project.full_path}", project.id.to_s, repository_path]
end
 
output, status = Gitlab::Popen.popen(command, nil, vars)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment