Class: Bleib::Database
- Inherits:
-
Object
- Object
- Bleib::Database
- Defined in:
- lib/bleib/database.rb
Overview
Finds out if a database is running and accessible.
Does so by using ActiveRecord without a booted rails environment (because a non-accessible database can cause the bootup to fail).
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Database
constructor
A new instance of Database.
- #wait_for_connection ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Database
Returns a new instance of Database.
8 9 10 |
# File 'lib/bleib/database.rb', line 8 def initialize(configuration) @configuration = configuration end |
Instance Method Details
#wait_for_connection ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/bleib/database.rb', line 12 def wait_for_connection logger.info('Waiting for connection to database') wait while database_down? logger.info('Connection to database established') # Nobody else shall use our single-connection pool. remove_connection end |