Class: WorkerKiller::Killer::RufusScheduler

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

Overview

Gracefully kills rufus scheduler.

Instance Method Summary collapse

Instance Method Details

#do_kill(sig, pid, alive_sec, scheduler:, timeout:, **_params) ⇒ Object

Parameters:

  • scheduler (Rufus::Scheduler)
  • timeout (Integer)


9
10
11
12
13
14
15
16
17
18
# File 'lib/worker_killer/killer/rufus_scheduler.rb', line 9

def do_kill(sig, pid, alive_sec, scheduler:, timeout:, **_params)
  if sig == :KILL
    logger.error { "#{self} force to #{sig} self (pid: #{pid}) alive: #{alive_sec} sec" }
    scheduler.shutdown(:kill)
    return
  end

  logger.warn { "#{self} run #{sig} self (pid: #{pid}) alive: #{alive_sec} sec, timeout: #{timeout} sec" }
  scheduler.shutdown(wait: timeout)
end