Class: Trellodon::Schedulers::Concurrent
- Defined in:
- lib/trellodon/schedulers/concurrent.rb
Constant Summary collapse
- DEFAULT_MAX_THREADS =
4
Instance Attribute Summary collapse
-
#max_threads ⇒ Object
readonly
Returns the value of attribute max_threads.
Instance Method Summary collapse
-
#initialize(threads_count = DEFAULT_MAX_THREADS) ⇒ Concurrent
constructor
A new instance of Concurrent.
- #post(&block) ⇒ Object
Constructor Details
#initialize(threads_count = DEFAULT_MAX_THREADS) ⇒ Concurrent
Returns a new instance of Concurrent.
15 16 17 |
# File 'lib/trellodon/schedulers/concurrent.rb', line 15 def initialize(threads_count = DEFAULT_MAX_THREADS) @max_threads = threads_count end |
Instance Attribute Details
#max_threads ⇒ Object (readonly)
Returns the value of attribute max_threads.
13 14 15 |
# File 'lib/trellodon/schedulers/concurrent.rb', line 13 def max_threads @max_threads end |
Instance Method Details
#post(&block) ⇒ Object
19 20 21 |
# File 'lib/trellodon/schedulers/concurrent.rb', line 19 def post(&block) ::Concurrent::Future.execute(executor:, &block) end |