Sha256: 8ec05c8baf120eb601e3e58437a86cb765277e65409972d694523c160da4c8f1
Contents?: true
Size: 954 Bytes
Versions: 2
Compression:
Stored size: 954 Bytes
Contents
module WorkerKiller module Killer class Base attr_accessor :config, :kill_attempts, :logger 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
worker_killer-1.0.5.213977 | lib/worker_killer/killer.rb |
worker_killer-1.0.5.213889 | lib/worker_killer/killer.rb |