Class: Puma::Cluster::Worker
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/puma/cluster.rb |
Class Method Summary
- .new(idx, pid, phase, options) ⇒ Worker constructor
Instance Attribute Summary
- #booted? ⇒ Boolean readonly
- #index readonly
- #last_checkin readonly
- #last_status readonly
- #phase readonly
- #pid readonly
- #signal readonly
- #started_at readonly
- #term? ⇒ Boolean readonly
Instance Method Summary
Constructor Details
.new(idx, pid, phase, options) ⇒ Worker
Instance Attribute Details
#booted? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/puma/cluster.rb', line 82
def booted? @stage == :booted end
#index (readonly)
[ GitHub ]# File 'lib/puma/cluster.rb', line 80
attr_reader :index, :pid, :phase, :signal, :last_checkin, :last_status, :started_at
#last_checkin (readonly)
[ GitHub ]# File 'lib/puma/cluster.rb', line 80
attr_reader :index, :pid, :phase, :signal, :last_checkin, :last_status, :started_at
#last_status (readonly)
[ GitHub ]# File 'lib/puma/cluster.rb', line 80
attr_reader :index, :pid, :phase, :signal, :last_checkin, :last_status, :started_at
#phase (readonly)
[ GitHub ]# File 'lib/puma/cluster.rb', line 80
attr_reader :index, :pid, :phase, :signal, :last_checkin, :last_status, :started_at
#pid (readonly)
[ GitHub ]# File 'lib/puma/cluster.rb', line 80
attr_reader :index, :pid, :phase, :signal, :last_checkin, :last_status, :started_at
#signal (readonly)
[ GitHub ]# File 'lib/puma/cluster.rb', line 80
attr_reader :index, :pid, :phase, :signal, :last_checkin, :last_status, :started_at
#started_at (readonly)
[ GitHub ]# File 'lib/puma/cluster.rb', line 80
attr_reader :index, :pid, :phase, :signal, :last_checkin, :last_status, :started_at
#term? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/puma/cluster.rb', line 91
def term? @term end
Instance Method Details
#boot!
[ GitHub ]# File 'lib/puma/cluster.rb', line 86
def boot! @last_checkin = Time.now @stage = :booted end
#hup
[ GitHub ]# File 'lib/puma/cluster.rb', line 122
def hup Process.kill "HUP", @pid rescue Errno::ESRCH end
#kill
[ GitHub ]# File 'lib/puma/cluster.rb', line 117
def kill Process.kill "KILL", @pid rescue Errno::ESRCH end
#ping!(status)
[ GitHub ]# File 'lib/puma/cluster.rb', line 95
def ping!(status) @last_checkin = Time.now @last_status = status end
#ping_timeout?(which) ⇒ Boolean
# File 'lib/puma/cluster.rb', line 100
def ping_timeout?(which) Time.now - @last_checkin > which end
#term (readonly)
[ GitHub ]# File 'lib/puma/cluster.rb', line 104
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 rescue Errno::ESRCH end end