module TreadMill::ForkCallbacks

Encapsulate before and after fork collbacks.

Public Class Methods

after_fork() click to toggle source
# File lib/tread_mill/fork_callbacks.rb, line 14
def self.after_fork
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.establish_connection
  end
end
before_fork() click to toggle source
# File lib/tread_mill/fork_callbacks.rb, line 7
def self.before_fork
  # as there's no need for the master process to hold a connection
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.connection.disconnect!
  end
end