class Puma::ThreadPool::AutoTrim - puma-3.11.4 Documentation

# class Puma::ThreadPool::AutoTrim

### Public Class Methods

new(pool, timeout) click to toggle source

    # File lib/puma/thread_pool.rb, line 203
    def initialize(pool, timeout)
      @pool = pool
      @timeout = timeout
      @running = false
    end

### Public Instance Methods

start!() click to toggle source

    # File lib/puma/thread_pool.rb, line 209
    def start!
      @running = true

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

stop() click to toggle source

    # File lib/puma/thread_pool.rb, line 220
    def stop
      @running = false
      @thread.wakeup
    end