Class: HasHelpers::HealthCheckController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/has_helpers/health_check_controller.rb

Instance Method Summary collapse

Instance Method Details

#pingObject



6
7
8
9
# File 'app/controllers/has_helpers/health_check_controller.rb', line 6

def ping
  logger.debug "in HealthCheckController#ping"
  render json: { healthy: true, when: Time.current.iso8601 }
end

#pingdbObject

the below two queries are needed because we have preemptible-vms and this busts the db cache https://cloud.google.com/preemptible-vms/



14
15
16
17
18
19
# File 'app/controllers/has_helpers/health_check_controller.rb', line 14

def pingdb
  ::ActiveRecord::Base.connection.execute("SELECT 1") rescue false

  logger.debug "in HealthCheckController#pingdb"
  render json: { healthy: true, when: Time.current.iso8601 }
end

#pingdbsObject



35
36
37
38
39
40
41
42
43
44
# File 'app/controllers/has_helpers/health_check_controller.rb', line 35

def pingdbs
  # the below two queries are needed because we have preemptible-vms
  # and this busts the db cache https://cloud.google.com/preemptible-vms/
  ::ActiveRecord::Base.connection.execute("SELECT 1") rescue false
  ::DataWarehouse.connection_pool.connection.execute("SELECT 1") rescue false
  ::GoodJob::Job.connection.exec_query("SELECT 1") rescue false

  logger.debug "in HealthCheckController#pingdbs"
  render json: { healthy: true, when: Time.current.iso8601 }
end

#pinggjObject



28
29
30
31
32
33
# File 'app/controllers/has_helpers/health_check_controller.rb', line 28

def pinggj
  ::ActiveRecord::Base.connection.execute("SELECT 1") rescue false
  ::GoodJob::Job.connection.exec_query("SELECT 1") rescue false
  logger.debug "in HealthCheckController#pinggj"
  render json: { healthy: true, when: Time.current.iso8601 }
end

#pingwhObject



21
22
23
24
25
# File 'app/controllers/has_helpers/health_check_controller.rb', line 21

def pingwh
  ::DataWarehouse.connection_pool.connection.execute("SELECT 1") rescue false
  logger.debug "in HealthCheckController#pingwh"
  render json: { healthy: true, when: Time.current.iso8601 }
end