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 def self.info
url = Setting.get('es_url').to_s url = Setting.get('es_url').to_s
return if url.blank?
Rails.logger.info "# curl -X GET \"#{url}\"" Rails.logger.info "# curl -X GET \"#{url}\""
response = UserAgent.get( response = UserAgent.get(
url, url,

View file

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