Class: WorkerKiller::Killer::Puma
- Defined in:
- lib/worker_killer/killer/puma.rb
Instance Attribute Summary collapse
-
#ipc_path ⇒ Object
Returns the value of attribute ipc_path.
-
#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(ipc_path:, worker_num: nil, **kwargs) ⇒ Puma
constructor
A new instance of Puma.
Methods inherited from Base
Constructor Details
#initialize(ipc_path:, worker_num: nil, **kwargs) ⇒ Puma
Returns a new instance of Puma.
9 10 11 12 13 |
# File 'lib/worker_killer/killer/puma.rb', line 9 def initialize(ipc_path:, worker_num: nil, **kwargs) super(**kwargs) @ipc_path = ipc_path @worker_num = worker_num end |
Instance Attribute Details
#ipc_path ⇒ Object
Returns the value of attribute ipc_path.
7 8 9 |
# File 'lib/worker_killer/killer/puma.rb', line 7 def ipc_path @ipc_path end |
#worker_num ⇒ Object
Returns the value of attribute worker_num.
7 8 9 |
# File 'lib/worker_killer/killer/puma.rb', line 7 def worker_num @worker_num end |
Instance Method Details
#do_kill(sig, pid, alive_sec, **_params) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/worker_killer/killer/puma.rb', line 15 def do_kill(sig, pid, alive_sec, **_params) return if @already_sended == sig logger.warn "#{self} send #{worker_num} to Puma Plugin (pid: #{pid}) alive: #{alive_sec} sec (trial #{kill_attempts}) triggered by #{sig}" @already_sended = sig Socket.unix(ipc_path) do |sock| sock.puts Integer(worker_num).to_s end end |