Class: Evilution::Parallel::WorkQueue::Dispatcher
- Inherits:
-
Object
- Object
- Evilution::Parallel::WorkQueue::Dispatcher
- Defined in:
- lib/evilution/parallel/work_queue/dispatcher.rb
Instance Attribute Summary collapse
-
#first_error ⇒ Object
readonly
Returns the value of attribute first_error.
Instance Method Summary collapse
-
#initialize(workers:, items:, prefetch:, item_timeout:, worker_max_items:, recycle_factory:) ⇒ Dispatcher
constructor
A new instance of Dispatcher.
- #run ⇒ Object
Constructor Details
#initialize(workers:, items:, prefetch:, item_timeout:, worker_max_items:, recycle_factory:) ⇒ Dispatcher
Returns a new instance of Dispatcher.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/evilution/parallel/work_queue/dispatcher.rb', line 9 def initialize(workers:, items:, prefetch:, item_timeout:, worker_max_items:, recycle_factory:) @workers = workers @items = items @prefetch = prefetch @item_timeout = item_timeout @worker_max_items = worker_max_items @recycle_factory = recycle_factory @state = Evilution::Parallel::WorkQueue.send(:const_get, :CollectionState).new(items.length) @retired = [] end |
Instance Attribute Details
#first_error ⇒ Object (readonly)
Returns the value of attribute first_error.
7 8 9 |
# File 'lib/evilution/parallel/work_queue/dispatcher.rb', line 7 def first_error @first_error end |
Instance Method Details
#run ⇒ Object
20 21 22 23 24 25 |
# File 'lib/evilution/parallel/work_queue/dispatcher.rb', line 20 def run seed collect @first_error = @state.first_error [@state.results, @retired] end |