Class: Puma::Cluster::Worker

### Home Classes Methods

### In Files

- lib/puma/cluster.rb

### Parent

Object

### Methods

- ::new
- #boot!
- #booted?
- #hup
- #kill
- #ping!
- #ping_timeout?
- #term

### Files

- Manifest.txt

### Class/Module Index

Quicksearch

- Puma
- Puma::App
- Puma::App::Status
- Puma::Binder
- Puma::CLI
- Puma::Client
- Puma::Cluster
- Puma::Cluster::Worker
- Puma::CommonLogger
- Puma::ConfigDefault
- Puma::Configuration
- Puma::Configuration::ConfigMiddleware
- Puma::ConnectionError
- Puma::Const
- Puma::ControlCLI
- Puma::DSL
- Puma::Delegation
- Puma::Events
- Puma::Events::DefaultFormatter
- Puma::Events::PidFormatter
- Puma::IOBuffer
- Puma::JRubyRestart
- Puma::JavaIOBuffer
- Puma::MiniSSL
- Puma::MiniSSL::Context
- Puma::MiniSSL::SSLError
- Puma::MiniSSL::Server
- Puma::MiniSSL::Socket
- Puma::NullIO
- Puma::Rack
- Puma::Rack::Builder
- Puma::Rack::Options
- Puma::Rack::URLMap
- Puma::Reactor
- Puma::Runner
- Puma::Server
- Puma::Single
- Puma::TCPLogger
- Puma::ThreadPool
- Puma::ThreadPool::AutoTrim
- Puma::ThreadPool::Reaper
- Puma::UnsupportedOption
- Puma::Util
- Puma::Util::HeaderHash
- OpenSSL
- OpenSSL::SSL
- OpenSSL::SSL::SSLServer
- Rack
- Rack::Handler
- Rack::Handler::Puma
- IO
- IO::WaitReadable
- Object
- Process
- String

No matching classes.

# 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

hup() click to toggle source

    # File lib/puma/cluster.rb, line 94
    def hup
      Process.kill "HUP", @pid
    rescue Errno::ESRCH
    end

kill() click to toggle source

    # File lib/puma/cluster.rb, line 89
    def kill
      Process.kill "KILL", @pid
    rescue Errno::ESRCH
    end

ping!() click to toggle source

    # File lib/puma/cluster.rb, line 68
    def ping!
      @last_checkin = Time.now
    end

ping_timeout?(which) click to toggle source

    # File lib/puma/cluster.rb, line 72
    def ping_timeout?(which)
      Time.now - @last_checkin > which
    end

term() click to toggle source

    # File lib/puma/cluster.rb, line 76
    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

[Validate]

Generated with the Darkfish Rdoc Generator 2.