Class: Rails::Service::StatusController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controller/rails/service/status_controller.rb

Overview

rubocop:disable Style/ClassAndModuleChildren

Constant Summary collapse

SELECT_ONE =
'SELECT 1'.freeze

Instance Method Summary collapse

Instance Method Details

#dbObject



16
17
18
19
20
21
22
# File 'app/controller/rails/service/status_controller.rb', line 16

def db
  time = Benchmark.realtime { ActiveRecord::Base.connection.execute(SELECT_ONE).first }
  render_status :ok, time: (time * 1_000).round(4)

rescue => ex
  render_status :critical, exception: ex.message, class: ex.class.to_s
end

#indexObject



10
11
12
# File 'app/controller/rails/service/status_controller.rb', line 10

def index
  render_status :ok, time: Time.current
end