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.



3
4
5
6
7
# File 'lib/puma_worker_killer/auto_reap.rb', line 3

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

Instance Method Details

#startObject



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

def start
  @running = true

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