Improved error handling.
This commit is contained in:
parent
f3cbe7f10e
commit
a08d5f1b51
2 changed files with 7 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue