Sha256: c62de888d1412dd56ce1c8c2e1369b0b821104df814f8053a0658360bf727dd8

Contents?: true

Size: 826 Bytes

Versions: 1

Compression:

Stored size: 826 Bytes

Contents

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

      def initialize **kwrags
        super
      end

      def do_kill(sig, pid, alive_sec, **_params)
        cmd = 'pumactl phased-restart'

        if sig == :KILL
          logger.error "#{self} force to kill self (pid: #{pid}) alive: #{alive_sec} sec (trial #{kill_attempts})"
          Process.kill sig, pid
          return
        end

        return if @already_detached

        logger.warn "#{self} run #{cmd.inspect} (pid: #{pid}) alive: #{alive_sec} sec (trial #{kill_attempts})"
        @already_detached = true

        Thread.new(cmd) do |command|
          unless Kernel.system(command)
            logger.warn "#{self} run #{command.inspect} failed: #{$?.inspect}"
          end
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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