Commit 6274e488 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '1606-parallelise-elastic_repo_indexer' into 'master'

Introduce one additional thread into bin/elastic_repo_indexer

See merge request !1372
parents 0efbf790 d2da1dbe
......@@ -10,6 +10,8 @@ require 'benchmark'
require File.expand_path('../lib/gitlab/elastic/client', File.dirname(__FILE__))
Thread.abort_on_exception = true
path_to_log_file = File.expand_path('../log/es-indexer.log', File.dirname(__FILE__))
LOGGER = Logger.new(path_to_log_file)
......@@ -56,17 +58,19 @@ repo = Repository.new
params = { from_rev: FROM_SHA, to_rev: TO_SHA }.compact
LOGGER.info("Indexing commits started")
commit_thr = Thread.new do
LOGGER.info("Indexing commits started")
timings = Benchmark.measure do
indexed = 0
repo.index_commits(params) do |batch, total_count|
indexed += batch.length
LOGGER.info("Indexed #{indexed}/#{total_count} commits")
timings = Benchmark.measure do
indexed = 0
repo.index_commits(params) do |batch, total_count|
indexed += batch.length
LOGGER.info("Indexed #{indexed}/#{total_count} commits")
end
end
end
LOGGER.info("Commits for #{REPO_PATH} are indexed. Time elapsed: #{timings.real}")
LOGGER.info("Commits for #{REPO_PATH} are indexed. Time elapsed: #{timings.real}")
end
LOGGER.info("Indexing blobs started")
......@@ -79,3 +83,5 @@ timings = Benchmark.measure do
end
LOGGER.info("Blobs for #{REPO_PATH} are indexed. Time elapsed: #{timings.real}")
commit_thr.join
---
title: Introduce one additional thread into bin/elastic_repo_indexer
merge_request: 1372
author:
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