Class: Trellodon::Schedulers::Concurrent

Inherits:
Base
  • Object
show all
Defined in:
lib/trellodon/schedulers/concurrent.rb

Constant Summary collapse

DEFAULT_MAX_THREADS =
4

Instance Attribute Summary collapse

Instance Method Summary collapse

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_threadsObject (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