Class: Contr::Async::Pool::Fixed
- Defined in:
- lib/contr/async/pool/fixed.rb
Instance Method Summary collapse
- #create_executor ⇒ Object
-
#initialize(max_threads: Concurrent.processor_count) ⇒ Fixed
constructor
A new instance of Fixed.
Methods inherited from Base
Constructor Details
#initialize(max_threads: Concurrent.processor_count) ⇒ Fixed
Returns a new instance of Fixed.
7 8 9 |
# File 'lib/contr/async/pool/fixed.rb', line 7 def initialize(max_threads: Concurrent.processor_count) @max_threads = max_threads end |
Instance Method Details
#create_executor ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/contr/async/pool/fixed.rb', line 11 def create_executor Concurrent::ThreadPoolExecutor.new( min_threads: 0, max_threads: @max_threads, auto_terminate: true, idletime: 60, # 1 minute max_queue: 0, # unlimited fallback_policy: :caller_runs # doesn't matter - max_queue 0 ) end |