Sha256: d318c4ed3d4f1ce2a85b99baaaddb95493ceaa741a8faeaf4e33de2067e23d84

Contents?: true

Size: 1008 Bytes

Versions: 1

Compression:

Stored size: 1008 Bytes

Contents

# frozen_string_literal: true

module WorkerKiller
  module RufusScheduler
    # Register rufus process killer by RAM usage.
    class OOMLimiter < ::WorkerKiller::RufusScheduler::BaseLimiter
      # @param scheduler [Rufus::Scheduler]
      # @param limiter_kwargs [Hash]
      # @param frequency [Integer,nil]
      # @param timeout [Integer]
      # @param logger [Logger,nil]
      # @param job_filter [Proc,nil] when frequency=null, used to select which jobs should be counted
      def initialize(scheduler:, frequency:, timeout:, logger: nil, job_filter: nil, **limiter_kwargs)
        # when frequency parameter used to set how often check should be run, check_cycle is not needed.
        limiter = ::WorkerKiller::MemoryLimiter.new(check_cycle: 1, **limiter_kwargs)
        super(
          scheduler: scheduler,
          frequency: frequency,
          timeout: timeout,
          limiter: limiter,
          logger: logger,
          job_filter: job_filter
        )
      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/rufus_scheduler/oom_limiter.rb