Class: Merb::BootLoader::DisconnectBeforeStartTransaction

Inherits:
Merb::BootLoader
  • Object
show all
Defined in:
lib/merb_sequel.rb

Overview

Disconnects from DB before starting reloading classes

We must disconnect from the DB before the worker process dies to be nice and not cause IO blocking.

Disconnect only when fork_for_class_relaod is set and we’re not in testing mode.

Class Method Summary collapse

Class Method Details

.runObject



78
79
80
81
82
83
# File 'lib/merb_sequel.rb', line 78

def self.run
  if Merb::Config[:fork_for_class_load] && !Merb.testing?
    Merb.logger.info "Disconnecting database connection before starting transaction."
    ::Sequel::DATABASES.each { |db| db.disconnect }
  end
end