class Uc::Unicorn::ReadyEvent
Attributes
ready_wait[R]
run_id[RW]
server[R]
worker[R]
Public Class Methods
new(server, worker, run_id: nil, ready_wait: nil)
click to toggle source
# File lib/uc/unicorn/ready_event.rb, line 16 def initialize(server, worker, run_id: nil, ready_wait: nil) @server = server @worker = worker @run_id = run_id @ready_wait = ready_wait end
Public Instance Methods
event()
click to toggle source
# File lib/uc/unicorn/ready_event.rb, line 48 def event run_id ? "ready_#{run_id}" : "ready" end
id()
click to toggle source
# File lib/uc/unicorn/ready_event.rb, line 35 def id @id ||= worker.nr + 1 end
mq()
click to toggle source
# File lib/uc/unicorn/ready_event.rb, line 52 def mq @mq ||= ::Uc::Mqueue.new(queue_name, max_msg: 10, msg_size: 30) end
notify()
click to toggle source
# File lib/uc/unicorn/ready_event.rb, line 39 def notify mq.create msg = mq.nb_writer do |writer| writer.send event end rescue Errno::ENOENT, Errno::EAGAIN, Errno::EACCES => e event_stream.warn "ready event not sent for worker #{id}: #{e.class}" end
queue_name()
click to toggle source
# File lib/uc/unicorn/ready_event.rb, line 31 def queue_name @queue_name ||= "#{event_queue}_ready_#{worker.nr + 1}" end
run()
click to toggle source
# File lib/uc/unicorn/ready_event.rb, line 23 def run event_stream.info "worker #{id} ready" if not last_worker? notify if ready_wait end # event_stream.pub :fin, "server #{server_event} successful" end