Class: IOPromise::ExecutorPool::Batch
- Defined in:
- lib/iopromise/executor_pool/batch.rb
Direct Known Subclasses
Deferred::DeferredExecutorPool, Memcached::MemcacheExecutorPool
Instance Method Summary collapse
-
#initialize(connection_pool) ⇒ Batch
constructor
A new instance of Batch.
- #next_batch ⇒ Object
Methods inherited from Base
#begin_executing, #complete, #execute_continue, for, #register, #sync
Constructor Details
#initialize(connection_pool) ⇒ Batch
6 7 8 9 10 |
# File 'lib/iopromise/executor_pool/batch.rb', line 6 def initialize(connection_pool) super(connection_pool) @current_batch = [] end |
Instance Method Details
#next_batch ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/iopromise/executor_pool/batch.rb', line 12 def next_batch # ensure that all current items are fully completed @current_batch.each do |promise| promise.wait end # every pending operation becomes part of the current batch @current_batch = @pending.dup end |