Class: Wellness::Services::PostgresService

Inherits:
Base
  • Object
show all
Defined in:
lib/wellness/services/postgres_service.rb

Overview

Author:

  • Matthew A. Johnston

Instance Attribute Summary

Attributes inherited from Base

#name, #params, #result

Instance Method Summary collapse

Methods inherited from Base

#call, dependency, #failed_check, #healthy?, #initialize, #passed_check

Constructor Details

This class inherits a constructor from Wellness::Services::Base

Instance Method Details

#checkHash

Returns:

  • (Hash)


12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/wellness/services/postgres_service.rb', line 12

def check
  case PG::Connection.ping(connection_options)
  when PG::Constants::PQPING_NO_ATTEMPT
    ping_failed('no attempt made to ping')
  when PG::Constants::PQPING_NO_RESPONSE
    ping_failed('no response from ping')
  when PG::Constants::PQPING_REJECT
    ping_failed('ping was rejected')
  else
    ping_successful
  end
end