class Puma::Cluster::Worker

Attributes

index[R]
last_checkin[R]
phase[R]
pid[R]
signal[R]

Public Class Methods

new(idx, pid, phase) click to toggle source
# File vendor/gems/puma-2.8.2-java/lib/puma/cluster.rb, line 40
def initialize(idx, pid, phase)
  @index = idx
  @pid = pid
  @phase = phase
  @stage = :started
  @signal = "TERM"
  @last_checkin = Time.now
end

Public Instance Methods

boot!() click to toggle source
# File vendor/gems/puma-2.8.2-java/lib/puma/cluster.rb, line 55
def boot!
  @last_checkin = Time.now
  @stage = :booted
end
booted?() click to toggle source
# File vendor/gems/puma-2.8.2-java/lib/puma/cluster.rb, line 51
def booted?
  @stage == :booted
end
kill() click to toggle source
# File vendor/gems/puma-2.8.2-java/lib/puma/cluster.rb, line 81
def kill
  Process.kill "KILL", @pid
rescue Errno::ESRCH
end
ping!() click to toggle source
# File vendor/gems/puma-2.8.2-java/lib/puma/cluster.rb, line 60
def ping!
  @last_checkin = Time.now
end
ping_timeout?(which) click to toggle source
# File vendor/gems/puma-2.8.2-java/lib/puma/cluster.rb, line 64
def ping_timeout?(which)
  Time.now - @last_checkin > which
end
term() click to toggle source
# File vendor/gems/puma-2.8.2-java/lib/puma/cluster.rb, line 68
def term
  begin
    if @first_term_sent && (Time.new - @first_term_sent) > 30
      @signal = "KILL"
    else
      @first_term_sent ||= Time.new
    end

    Process.kill @signal, @pid
  rescue Errno::ESRCH
  end
end