module Concurrent::Throttle::PromisesIntegration
Public Instance Methods
throttled_future(*args, &task)
click to toggle source
Behaves as {Promises::FactoryMethods#future} but the future is throttled. @return [Promises::Future] @see Promises::FactoryMethods#future @!macro throttle.example.throttled_future
# File lib-edge/concurrent/edge/throttle.rb, line 145 def throttled_future(*args, &task) trigger.chain(*args, &task).on_resolution! { release } end
throttled_future_chain(&throttled_futures)
click to toggle source
Allows to throttle a chain of promises. @yield [trigger] a trigger which has to be used to build up a chain of promises, the last one is result
of the block. When the last one resolves, {Throttle#release} is called on the throttle.
@yieldparam [Promises::Event, Promises::Future] trigger @yieldreturn [Promises::Event, Promises::Future] The final future of the throttled chain. @return [Promises::Event, Promises::Future] The final future of the throttled chain. @!macro throttle.example.throttled_future_chain
# File lib-edge/concurrent/edge/throttle.rb, line 137 def throttled_future_chain(&throttled_futures) throttled_futures.call(trigger).on_resolution! { release } end