class Puma::ThreadPool

def wait_for_less_busy_worker(delay_s)

Other tags:
    Version: - 5.0.0
def wait_for_less_busy_worker(delay_s)
  return unless delay_s && delay_s > 0
  # Ruby MRI does GVL, this can result
  # in processing contention when multiple threads
  # (requests) are running concurrently
  return unless Puma.mri?
  with_mutex do
    return if @shutdown
    # do not delay, if we are not busy
    return unless busy_threads > 0
    # this will be signaled once a request finishes,
    # which can happen earlier than delay
    @not_full.wait @mutex, delay_s
  end
end