Module: Ernicorn::AdminRPC

Defined in:
lib/ernicorn/adminrpc.rb

Instance Method Summary collapse

Instance Method Details

#haltObject



28
29
30
31
# File 'lib/ernicorn/adminrpc.rb', line 28

def halt
  Process.kill 'QUIT', master_pid
  "Sent QUIT to #{master_pid}"
end

#master_pidObject



33
34
35
# File 'lib/ernicorn/adminrpc.rb', line 33

def master_pid
  $ernicorn.master_pid
end

#reload_handlersObject



23
24
25
26
# File 'lib/ernicorn/adminrpc.rb', line 23

def reload_handlers
  Process.kill 'USR2', master_pid
  "Sent USR2 to #{master_pid}"
end

#statsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/ernicorn/adminrpc.rb', line 5

def stats
  queued = active = 0

  Raindrops::Linux.tcp_listener_stats(Unicorn.listener_names).each do |addr,stats|
    queued += stats.queued
    active += stats.active
  end if defined?(Raindrops::Linux.tcp_listener_stats)

  return <<STATS
connections.total=#{Stats.connections_total}
connections.completed=#{Stats.connections_completed}
workers.idle=#{Stats.workers_idle}
workers.busy=#{active}
queue.high=#{queued}
queue.low=0
STATS
end