Method: Concurrent::Promises::Future#schedule

Defined in:
lib/concurrent-ruby/concurrent/promises.rb

#schedule(intended_time) ⇒ Future

Creates new event dependent on receiver scheduled to execute on/in intended_time. In time is interpreted from the moment the receiver is resolved, therefore it inserts delay into the chain.

Parameters:

  • intended_time (Numeric, Time)

    Numeric means to run in intended_time seconds. Time means to run on intended_time.

Returns:



1102
1103
1104
1105
1106
1107
# File 'lib/concurrent-ruby/concurrent/promises.rb', line 1102

def schedule(intended_time)
  chain do
    event = ScheduledPromise.new(@DefaultExecutor, intended_time).event
    ZipFutureEventPromise.new_blocked_by2(self, event, @DefaultExecutor).future
  end.flat
end