Class: WorkerKiller::Killer::DelayedJob

Inherits:
Base
  • Object
show all
Defined in:
lib/worker_killer/killer/delayed_job.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #kill_attempts

Instance Method Summary collapse

Methods inherited from Base

#initialize, #kill, #logger

Constructor Details

This class inherits a constructor from WorkerKiller::Killer::Base

Instance Method Details

#do_kill(sig, pid, alive_sec, dj:, **_kwargs) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/worker_killer/killer/delayed_job.rb', line 5

def do_kill(sig, pid, alive_sec, dj:, **_kwargs)
  case sig
  when :QUIT
    logger.info "#{self.class}: try to stop DelayedJob due to #{sig} self (pid: #{pid}) alive: #{alive_sec} sec (kill attempts #{kill_attempts})"
    dj.stop
  when :TERM
    logger.warn "#{self.class}: force to #{sig} self (pid: #{pid}) alive: #{alive_sec} sec (kill attempts #{kill_attempts})"
    Process.kill sig, pid
  when :KILL
    logger.error "#{self.class}: force to #{sig} self (pid: #{pid}) alive: #{alive_sec} sec (kill attempts #{kill_attempts})"
    Process.kill sig, pid
  else
    logger.error "#{self.class}: DO NOTHING: unknown #{sig} self (pid: #{pid}) alive: #{alive_sec} sec (kill attempts #{kill_attempts})"
  end
end