Class: WorkerKiller::RufusScheduler::JobsLimiter

Inherits:
BaseLimiter
  • Object
show all
Defined in:
lib/worker_killer/rufus_scheduler/jobs_limiter.rb

Overview

Register rufus process killer by RAM usage.

Instance Attribute Summary

Attributes inherited from BaseLimiter

#frequency, #job_filter, #killer, #limiter, #scheduler, #timeout

Instance Method Summary collapse

Methods inherited from BaseLimiter

#check_after_job?, #register, register, #run_check

Constructor Details

#initialize(scheduler:, timeout:, logger: nil, job_filter: nil, **limiter_kwargs) ⇒ JobsLimiter

Returns a new instance of JobsLimiter.

Parameters:

  • scheduler (Rufus::Scheduler)
  • limiter_kwargs (Hash)
  • timeout (Integer)
  • logger (Logger, nil) (defaults to: nil)
  • job_filter (Proc, nil) (defaults to: nil)

    used to select which jobs should be counted



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/worker_killer/rufus_scheduler/jobs_limiter.rb', line 12

def initialize(scheduler:, timeout:, logger: nil, job_filter: nil, **limiter_kwargs)
  limiter = ::WorkerKiller::CountLimiter.new(**limiter_kwargs)
  super(
    scheduler: scheduler,
    frequency: nil,
    timeout: timeout,
    limiter: limiter,
    logger: logger,
    job_filter: job_filter
  )
end