module Unicorn::Wrangler::Utils

Public Instance Methods

debug(message) click to toggle source
# File lib/unicorn/wrangler.rb, line 17
def debug(message)
  Thread.new do
    Wrangler.logger.debug(message)
  end.join
end
trap_signals(*signals, &block) click to toggle source
# File lib/unicorn/wrangler.rb, line 23
def trap_signals(*signals, &block)
  signals.map(&:to_s).each do |signal|
    trap(signal) do
      debug "received #{signal} (watching #{unicorn.pid})"
      block.call signal
    end
  end
end
wait_for(seconds, &block) click to toggle source
# File lib/unicorn/wrangler.rb, line 32
def wait_for(seconds, &block)
  end_time = Time.now + seconds
  until Time.now > end_time || block.call
    sleep 0.1
  end
  block.call
end
warn(message) click to toggle source
# File lib/unicorn/wrangler.rb, line 13
def warn(message)
  Wrangler.logger.warn(message)
end