class Puma::Cluster::Worker
Attributes
index[R]
last_checkin[R]
phase[R]
pid[R]
signal[R]
Public Class Methods
new(idx, pid, phase, options)
click to toggle source
# File lib/puma/cluster.rb, line 46 def initialize(idx, pid, phase, options) @index = idx @pid = pid @phase = phase @stage = :started @signal = "TERM" @options = options @first_term_sent = nil @last_checkin = Time.now end
Public Instance Methods
boot!()
click to toggle source
# File lib/puma/cluster.rb, line 63 def boot! @last_checkin = Time.now @stage = :booted end
booted?()
click to toggle source
# File lib/puma/cluster.rb, line 59 def booted? @stage == :booted end
dead!()
click to toggle source
# File lib/puma/cluster.rb, line 72 def dead! @dead = true end
dead?()
click to toggle source
# File lib/puma/cluster.rb, line 68 def dead? @dead end
hup()
click to toggle source
# File lib/puma/cluster.rb, line 102 def hup Process.kill "HUP", @pid rescue Errno::ESRCH end
kill()
click to toggle source
# File lib/puma/cluster.rb, line 97 def kill Process.kill "KILL", @pid rescue Errno::ESRCH end
ping!()
click to toggle source
# File lib/puma/cluster.rb, line 76 def ping! @last_checkin = Time.now end
ping_timeout?(which)
click to toggle source
# File lib/puma/cluster.rb, line 80 def ping_timeout?(which) Time.now - @last_checkin > which end
term()
click to toggle source
# File lib/puma/cluster.rb, line 84 def term begin if @first_term_sent && (Time.new - @first_term_sent) > @options[:worker_shutdown_timeout] @signal = "KILL" else @first_term_sent ||= Time.new end Process.kill @signal, @pid rescue Errno::ESRCH end end