Class: StatusController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/app/controllers/status_controller.rb

Overview

Return the status of the server

Instance Method Summary collapse

Instance Method Details

#indexObject

Main (and only) page



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/app/controllers/status_controller.rb', line 10

def index
  components = { mongo: mongo_status, redis: redis_status, job_count: job_count_status, cron_job: cron_job_status }

  respond_to do |format|
    format.html { render :index, locals: { components: components }, layout: false }
    format.json { render json: components.to_json }
    format.text do
      overall = components.collect { |_key, item| item[:success] }.all?
      render plain: components.flatten, status: overall ? 200 : 500
    end
  end
end