Class: IOPromise::Deferred::DeferredExecutorPool

Inherits:
ExecutorPool::Batch show all
Defined in:
lib/iopromise/deferred/executor_pool.rb

Instance Method Summary collapse

Methods inherited from ExecutorPool::Batch

#initialize, #next_batch

Methods inherited from ExecutorPool::Base

#begin_executing, #complete, for, #initialize, #register, #sync

Constructor Details

This class inherits a constructor from IOPromise::ExecutorPool::Batch

Instance Method Details

#execute_continue(ready_readers, ready_writers, ready_exceptions) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/iopromise/deferred/executor_pool.rb', line 6

def execute_continue(ready_readers, ready_writers, ready_exceptions)
  if @current_batch.empty?
    next_batch
  end

  until @current_batch.empty?
    # we are just running this in the sync cycle, in a blocking way.
    @current_batch.each do |promise|
      begin_executing(promise)
      promise.run_deferred
      complete(promise)
    end

    @current_batch = []

    next_batch
  end

  # we always fully complete each cycle
  return [[], [], [], nil]
end