Permalink
Browse files

Test stabilization: Increase read timeout of Elasticsearch index crea…

…tion to avoid index_already_exists_exception because of retry.
  • Loading branch information...
thorsteneckel committed Jul 7, 2018
1 parent 8172b17 commit 132a88005ffabc40bee4935209897fb1c293c935
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/search_index_backend.rb
@@ -165,13 +165,19 @@ def self.index(data)
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'),
}

0 comments on commit 132a880

Please sign in to comment.