Commit 816f69ba authored by James Lopez's avatar James Lopez

Merge branch '257838-fix-cluster-reindexing-service' into 'master'

Fix ClusterReindexingService infinite loop

See merge request gitlab-org/gitlab!46224
parents 9cf57146 9148cb62
......@@ -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