Test stabilization: Increase read timeout of Elasticsearch index creation to avoid index_already_exists_exception because of retry.

This commit is contained in:
Thorsten Eckel 2018-07-07 11:11:16 +02:00
parent 8172b17733
commit 132a88005f

View file

@ -165,13 +165,19 @@ create/update/delete index
Rails.logger.info "# curl -X PUT \"#{url}\" \\"
Rails.logger.debug { "-d '#{data[:data].to_json}'" }
# note that we use a high read timeout here because
# otherwise the request will be retried (underhand)
# which leads to an "index_already_exists_exception"
# HTTP 400 status error
# see: https://github.com/ankane/the-ultimate-guide-to-ruby-timeouts/issues/8
# Improving the Elasticsearch config is probably the proper solution
response = UserAgent.put(
url,
data[:data],
{
json: true,
open_timeout: 8,
read_timeout: 12,
read_timeout: 30,
user: Setting.get('es_user'),
password: Setting.get('es_password'),
}