Class: PumaWorkerKiller::AutoReap

Inherits:
Object
  • Object
show all
Defined in:
lib/puma_worker_killer/auto_reap.rb

Instance Method Summary collapse

Constructor Details

#initialize(timeout, reaper = Reaper.new) ⇒ AutoReap

Returns a new instance of AutoReap.



5
6
7
8
9
# File 'lib/puma_worker_killer/auto_reap.rb', line 5

def initialize(timeout, reaper = Reaper.new)
  @timeout = timeout # seconds
  @reaper = reaper
  @running = false
end

Instance Method Details

#startObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/puma_worker_killer/auto_reap.rb', line 11

def start
  @running = true

  Thread.new do
    while @running
      sleep @timeout
      @reaper.reap
    end
  end
end