Class: Healthchecker::Checks::Solr

Inherits:
Healthchecker::Check show all
Defined in:
lib/healthchecker/checks/solr.rb

Instance Attribute Summary

Attributes inherited from Healthchecker::Check

#options

Instance Method Summary collapse

Methods inherited from Healthchecker::Check

#initialize, #perform_check

Constructor Details

This class inherits a constructor from Healthchecker::Check

Instance Method Details

#check!Object



16
17
18
19
20
21
22
# File 'lib/healthchecker/checks/solr.rb', line 16

def check!
  msg = "Could not connect to solr"
  ping_success = client.head("admin/ping", :headers => {"Cache-Control" => "If-None-Match"}).response[:status] == 200
  raise msg unless ping_success
rescue => e
  raise msg
end

#clientObject



6
7
8
9
10
11
12
13
14
# File 'lib/healthchecker/checks/solr.rb', line 6

def client
  if options[:rsolr_client]
    options[:rsolr_client]
  elsif options[:url]
    RSolr.connect(url: options[:url])
  else
    Sunspot::Session.new.send(:connection)
  end
end