Class: SupplejackApi::StatusController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- SupplejackApi::StatusController
- Defined in:
- app/controllers/supplejack_api/status_controller.rb
Overview
rubocop:disable Metrics/LineLength FIXME: make log lines smaller
Constant Summary collapse
- TIMEOUT =
10.seconds
Instance Method Summary collapse
Methods inherited from ApplicationController
#authenticate_admin!, #authenticate_user!, #current_user, #find_user_set
Instance Method Details
#show ⇒ Object
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 |