Module: DTR::Master

Includes:
Adapter::Master, Service::WorkingEnv, SyncCodebase::MasterExt
Defined in:
lib/dtr/master.rb

Instance Method Summary collapse

Methods included from SyncCodebase::MasterExt

included, #with_dtr_master_with_sync_codebase

Methods included from Service::File

#lookup_file, #provide_file

Methods included from Service::Rinda

#lookup, #lookup_ring, #start_service, #stop_service

Methods included from Service::WorkingEnv

#lookup_working_env, #provide_working_env

Methods included from Adapter::Master

#do_wakeup_agents, #group_agents_should_die, #hypnotize_agents, #with_wakeup_agents

Instance Method Details

#with_dtr_master(&block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/dtr/master.rb', line 19

def with_dtr_master(&block)
  if defined?(ActiveRecord::Base)
    ActiveRecord::Base.clear_active_connections! rescue nil
  end

  DTR.info {""}
  DTR.info {"--------------------beautiful line--------------------------"}
  DTR.info {"Master process started at #{Time.now}"}
  DTR.info {"Master heartbeat interval: #{DTR.configuration.master_heartbeat_interval}"}

  DTR.root = Dir.pwd
  DTR.configuration.with_rinda_server do
    provide_working_env WorkingEnv.new
    with_wakeup_agents(&block)
  end
end