class Realm::MultiWorker

Public Class Methods

new(workers = []) click to toggle source
# File lib/realm/multi_worker.rb, line 5
def initialize(workers = [])
  @workers = workers
end

Public Instance Methods

join() click to toggle source
# File lib/realm/multi_worker.rb, line 18
def join
  @workers.each(&:join)
end
run() click to toggle source
# File lib/realm/multi_worker.rb, line 22
def run
  %w[INT TERM].each do |signal|
    Signal.trap(signal) { stop }
  end
  start
  join
end
start(*args) click to toggle source
# File lib/realm/multi_worker.rb, line 9
def start(*args)
  @workers.each { |w| w.start(*args) }
  self
end
stop(timeout: 30) click to toggle source
# File lib/realm/multi_worker.rb, line 14
def stop(timeout: 30)
  @workers.each { |w| w.stop(timeout: timeout) }
end