Class: WorkerKiller::Killer::Puma
- Defined in:
- lib/worker_killer/killer/puma.rb
Instance Attribute Summary collapse
-
#worker_num ⇒ Object
Returns the value of attribute worker_num.
Attributes inherited from Base
Instance Method Summary collapse
- #do_kill(sig, pid, alive_sec, **_params) ⇒ Object
-
#initialize(puma_plugin:, worker_num: nil, **kwargs) ⇒ Puma
constructor
A new instance of Puma.
Methods inherited from Base
Constructor Details
#initialize(puma_plugin:, worker_num: nil, **kwargs) ⇒ Puma
Returns a new instance of Puma.
7 8 9 10 11 |
# File 'lib/worker_killer/killer/puma.rb', line 7 def initialize(puma_plugin:, worker_num: nil, **kwargs) super(**kwargs) @puma_plugin = puma_plugin @worker_num = worker_num end |
Instance Attribute Details
#worker_num ⇒ Object
Returns the value of attribute worker_num.
5 6 7 |
# File 'lib/worker_killer/killer/puma.rb', line 5 def worker_num @worker_num end |
Instance Method Details
#do_kill(sig, pid, alive_sec, **_params) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/worker_killer/killer/puma.rb', line 13 def do_kill(sig, pid, alive_sec, **_params) return if @worker_num.nil? # May be nil if Puma not in Cluster mode return if @already_sended == sig logger.warn "#{self.class} send [W#{worker_num}] to Puma Plugin (from pid: #{pid}) alive: #{alive_sec} sec (kill attempts #{kill_attempts}) triggered by #{sig}" @already_sended = sig @puma_plugin.set_logger!(logger) @puma_plugin.request_restart_server(worker_num) end |