Method: SupplejackApi::StatusController#show

Defined in:
app/controllers/supplejack_api/status_controller.rb

#showObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/supplejack_api/status_controller.rb', line 21

def show
  both_ok = Timeout.timeout(TIMEOUT) do
    solr_ok = solr_up?
    mongo_ok = mongod_up?
    solr_ok && mongo_ok
  end

  if both_ok
    render status: 200, nothing: true
  else
    render status: 500, nothing: true
  end
rescue Timeout::Error => e
  Support::StatusLogger.logger.error("Solr or MongoDB is down or took longer than #{TIMEOUT} seconds to respond. Exception is #{e}.\nBacktrace #{e.backtrace[0..2].join("\n")}")

  render status: 500, nothing: true
end