class Puma::Cluster::WorkerHandle
:nodoc:
see Puma::Cluster::Worker.
include the actual logic executed by the worker process itself. For that,
and it exposes methods to control the process via IPC. It does not
master process. It contains information about the process and its health
This class represents a worker process from the perspective of the puma
def boot!
def boot! @last_checkin = Time.now @stage = :booted end
def booted?
def booted? @stage == :booted end
def hup
def hup Process.kill "HUP", @pid rescue Errno::ESRCH end
def initialize(idx, pid, phase, options)
see Puma::Cluster::Worker.
include the actual logic executed by the worker process itself. For that,
and it exposes methods to control the process via IPC. It does not
master process. It contains information about the process and its health
This class represents a worker process from the perspective of the puma
def initialize(idx, pid, phase, options) @index = idx @pid = pid @phase = phase @stage = :started @signal = "TERM" @options = options @first_term_sent = nil @started_at = Time.now @last_checkin = Time.now @last_status = {} @term = false end
def kill
def kill @signal = 'KILL' term end
def ping!(status)
def ping!(status) @last_checkin = Time.now captures = status.match(/{ "backlog":(?<backlog>\d*), "running":(?<running>\d*), "pool_capacity":(?<pool_capacity>\d*), "max_threads": (?<max_threads>\d*), "requests_count": (?<requests_count>\d*) }/) @last_status = captures.names.inject({}) do |hash, key| hash[key.to_sym] = captures[key].to_i hash end end
def ping_timeout
- Version: - 5.0.0
Other tags:
- See: Puma::Cluster#check_workers -
def ping_timeout @last_checkin + (booted? ? @options[:worker_timeout] : @options[:worker_boot_timeout] ) end
def term
def term begin if @first_term_sent && (Time.now - @first_term_sent) > @options[:worker_shutdown_timeout] @signal = "KILL" else @term ||= true @first_term_sent ||= Time.now end Process.kill @signal, @pid if @pid rescue Errno::ESRCH end end
def term!
def term! @term = true end
def term?
def term? @term end
def uptime
def uptime Time.now - started_at end