Sha256: 5a4d234c9608a14f630a118243482a4931a1785a84da45b6cf1657a11ddfbb64
Contents?: true
Size: 866 Bytes
Versions: 8
Compression:
Stored size: 866 Bytes
Contents
module WorkerKiller module Killer class Base attr_accessor :config, :kill_attempts, :logger def initialize(logger: WorkerKiller.configuration.logger, **_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: end end end require_relative 'killer/signal' require_relative 'killer/passenger' require_relative 'killer/delayed_job'
Version data entries
8 entries across 8 versions & 1 rubygems