Sha256: 4eb4f14e0cb95b38a5c442476f9880bf58fb4a2f1f693277262a9cc1e7cc94ad
Contents?: true
Size: 903 Bytes
Versions: 30
Compression:
Stored size: 903 Bytes
Contents
require 'concurrent/executor/ruby_thread_pool_executor' module Concurrent # @!macro cached_thread_pool class RubyCachedThreadPool < RubyThreadPoolExecutor # Create a new thread pool. # # @param [Hash] opts the options defining pool behavior. # number of seconds a thread may be idle before it is reclaimed # # @raise [ArgumentError] if `overflow_policy` is not a known policy def initialize(opts = {}) overflow_policy = opts.fetch(:overflow_policy, :abort) raise ArgumentError.new("#{overflow_policy} is not a valid overflow policy") unless OVERFLOW_POLICIES.include?(overflow_policy) opts = opts.merge( min_threads: 0, max_threads: DEFAULT_MAX_POOL_SIZE, overflow_policy: overflow_policy, max_queue: DEFAULT_MAX_QUEUE_SIZE, idletime: DEFAULT_THREAD_IDLETIMEOUT ) super(opts) end end end
Version data entries
30 entries across 30 versions & 1 rubygems