Sha256: 1fd3629c59ff3045d75cfa57a0e86b9ecbf6946888cb5a3daf31e6853b9ca1a0

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

# frozen_string_literal: true

module WorkerKiller
  module Killer
    # Gracefully kills rufus scheduler.
    class RufusScheduler < ::WorkerKiller::Killer::Base
      # @param scheduler [Rufus::Scheduler]
      # @param timeout [Integer]
      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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
worker_killer-rufus_scheduler-1.1.0 lib/worker_killer/killer/rufus_scheduler.rb