Commit 9148cb62 authored by Dmitry Gruzd's avatar Dmitry Gruzd Committed by James Lopez

Fix ClusterReindexingService infinite loop

parent efceaf81
......@@ -100,6 +100,10 @@ module Elastic
end
true
rescue Elasticsearch::Transport::Transport::Error
abort_reindexing!("Couldn't load task status")
false
end
def compare_documents_count
......
---
title: Fix Global Search Reindexing when reindexing task is not found
merge_request: 46224
author:
type: fixed
......@@ -71,6 +71,13 @@ RSpec.describe Elastic::ClusterReindexingService, :elastic do
expect { subject.execute }.to change { task.reload.state }.from('reindexing').to('failure')
expect(task.reload.error_message).to match(/has failed with/)
end
it 'errors if task is not found' do
allow(Gitlab::Elastic::Helper.default).to receive(:task_status).and_raise(Elasticsearch::Transport::Transport::Errors::NotFound)
expect { subject.execute }.to change { task.reload.state }.from('reindexing').to('failure')
expect(task.reload.error_message).to match(/couldn't load task status/i)
end
end
context 'task finishes correctly' do
......
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