Sha256: 5180eaa0bd07f1db80d540941a53b865d45e7d9be990bb957bf79b61d293d971

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

require 'socket'

module ::WorkerKiller
  module Killer
    class Puma < ::WorkerKiller::Killer::Base

      attr_accessor :ipc_path, :worker_num

      def initialize(ipc_path:, worker_num: nil, **kwargs)
        super(**kwargs)
        @ipc_path = ipc_path
        @worker_num = worker_num
      end

      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})"

        @already_sended = sig

        Socket.unix(ipc_path) do |sock|
          sock.puts Integer(worker_num).to_s
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
worker_killer-1.1.0.214159 lib/worker_killer/killer/puma.rb