123456789_123456789_123456789_123456789_123456789_

Class: Puma::ThreadPool::AutoTrim

Relationships & Source Files
Inherits: Object
Defined in: lib/puma/thread_pool.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(pool, timeout) ⇒ AutoTrim

[ GitHub ]

  
# File 'lib/puma/thread_pool.rb', line 244

def initialize(pool, timeout)
  @pool = pool
  @timeout = timeout
  @running = false
end

Instance Method Details

#start!

[ GitHub ]

  
# File 'lib/puma/thread_pool.rb', line 250

def start!
  @running = true

  @thread = Thread.new do
    while @running
      @pool.trim
      sleep @timeout
    end
  end
end

#stop

[ GitHub ]

  
# File 'lib/puma/thread_pool.rb', line 261

def stop
  @running = false
  @thread.wakeup
end