Sha256: 5c9e79ed938f6684ed2fc80a2439d4f50a190089884fc718ba933853722a3ba7
Contents?: true
Size: 939 Bytes
Versions: 3
Compression:
Stored size: 939 Bytes
Contents
module WorkerKiller module Killer class Base attr_accessor :config, :kill_attempts def initialize(logger: nil, **_kwargs) @logger = logger @config = WorkerKiller.configuration @kill_attempts = 0 end def kill(start_time, **params) alive_sec = (Time.now - start_time).round @kill_attempts += 1 sig = :QUIT sig = :TERM if kill_attempts > config.quit_attempts sig = :KILL if kill_attempts > (config.quit_attempts + config.term_attempts) do_kill(sig, Process.pid, alive_sec, **params) end # :nocov: def do_kill(*_args) raise 'Not Implemented' end # :nocov: def logger @logger || WorkerKiller.configuration.logger end end end end require_relative 'killer/signal' require_relative 'killer/passenger' require_relative 'killer/puma' require_relative 'killer/delayed_job'
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
worker_killer-1.1.0.223443 | lib/worker_killer/killer.rb |
worker_killer-1.1.0.214159 | lib/worker_killer/killer.rb |
worker_killer-1.1.0.214146 | lib/worker_killer/killer.rb |