Module: Resque::Plugins::WorkerKiller

Defined in:
lib/resque/plugins/worker_killer.rb,
lib/resque/plugins/worker_killer/version.rb

Defined Under Namespace

Classes: PrivateMethods

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/resque/plugins/worker_killer.rb', line 28

def self.extended(klass)
  Resque.after_fork do |job|
    # this is ran in the forked child process
    # we do not let the monitor thread die since the process itself dies
    Thread.start { PrivateMethods.new(klass).monitor_oom }
  end
end

Instance Method Details

#worker_killer_loggerObject



24
25
26
# File 'lib/resque/plugins/worker_killer.rb', line 24

def worker_killer_logger
  @worker_killer_logger ||= ::Resque.logger
end

#worker_killer_max_termObject



15
16
17
# File 'lib/resque/plugins/worker_killer.rb', line 15

def worker_killer_max_term
  @worker_killer_max_term ||= 10
end

#worker_killer_mem_limitObject



11
12
13
# File 'lib/resque/plugins/worker_killer.rb', line 11

def worker_killer_mem_limit
  @worker_killer_mem_limit ||= 300 * 1024 # killo bytes
end

#worker_killer_monitor_intervalObject



7
8
9
# File 'lib/resque/plugins/worker_killer.rb', line 7

def worker_killer_monitor_interval
  @worker_killer_monitor_interval ||= 1.0 # sec
end

#worker_killer_verboseObject



19
20
21
22
# File 'lib/resque/plugins/worker_killer.rb', line 19

def worker_killer_verbose
  @worker_killer_verbose = false if @worker_killer_verbose.nil?
  @worker_killer_verbose
end