Class: Puma::Cluster::Worker
- Inherits:
-
Object
- Object
- Puma::Cluster::Worker
- Defined in:
- lib/puma/cluster.rb
Instance Attribute Summary collapse
-
#phase ⇒ Object
readonly
Returns the value of attribute phase.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#signal ⇒ Object
readonly
Returns the value of attribute signal.
Instance Method Summary collapse
- #boot! ⇒ Object
- #booted? ⇒ Boolean
-
#initialize(pid, phase) ⇒ Worker
constructor
A new instance of Worker.
- #term ⇒ Object
Constructor Details
#initialize(pid, phase) ⇒ Worker
Returns a new instance of Worker.
32 33 34 35 36 37 |
# File 'lib/puma/cluster.rb', line 32 def initialize(pid, phase) @pid = pid @phase = phase @stage = :started @signal = "TERM" end |
Instance Attribute Details
#phase ⇒ Object (readonly)
Returns the value of attribute phase.
39 40 41 |
# File 'lib/puma/cluster.rb', line 39 def phase @phase end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
39 40 41 |
# File 'lib/puma/cluster.rb', line 39 def pid @pid end |
#signal ⇒ Object (readonly)
Returns the value of attribute signal.
39 40 41 |
# File 'lib/puma/cluster.rb', line 39 def signal @signal end |
Instance Method Details
#boot! ⇒ Object
45 46 47 |
# File 'lib/puma/cluster.rb', line 45 def boot! @stage = :booted end |
#booted? ⇒ Boolean
41 42 43 |
# File 'lib/puma/cluster.rb', line 41 def booted? @stage == :booted end |
#term ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/puma/cluster.rb', line 49 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 |