Improved error handling.

This commit is contained in:
Martin Edenhofer 2017-12-04 02:12:55 +01:00
parent f3cbe7f10e
commit a08d5f1b51
2 changed files with 7 additions and 2 deletions

View file

@ -12,6 +12,7 @@ info about used search index machine
def self.info
url = Setting.get('es_url').to_s
return if url.blank?
Rails.logger.info "# curl -X GET \"#{url}\""
response = UserAgent.get(
url,

View file

@ -16,8 +16,12 @@ namespace :searchindex do
puts 'create indexes...'
# es with mapper-attachments plugin
number = SearchIndexBackend.info['version']['number'].to_s
if number =~ /^[2-4]\./ || number =~ /^5\.[0-5]\./
info = SearchIndexBackend.info
number = nil
if info.present?
number = info['version']['number'].to_s
end
if number.blank? || number =~ /^[2-4]\./ || number =~ /^5\.[0-5]\./
# create indexes
SearchIndexBackend.index(