Class List Method List File List

# Module: Concurrent::Promises::AbstractEventFuture::ThrottleIntegration

Included in:
  Concurrent::Promises::AbstractEventFuture
Defined in:
  lib/concurrent/edge/throttle.rb

## Instance Method Summary (collapse)

- - (Promises::Future, Promises::Event) chain_throttled_by(throttle, *args, &block)

  Behaves as #chain but the it is throttled.

- - (undocumented) throttled_by(throttle, &throttled_futures)

## Instance Method Details

### - (`Promises::Future`, `Promises::Event`) chain_throttled_by(throttle, *args, &block)

Behaves as Concurrent::Promises::AbstractEventFuture#chain but the it is throttled.

Returns:

- (`Promises::Future`, `Promises::Event`)

See Also:

- Concurrent::Promises::AbstractEventFuture#chain

    162
    163
    164

    # File 'lib/concurrent/edge/throttle.rb', line 162

    def chain_throttled_by(throttle, *args, &block)
      throttled_by(throttle) { |trigger| trigger.chain(*args, &block) }
    end

### - (`undocumented`) throttled_by(throttle, &throttled_futures)

    154
    155
    156
    157

    # File 'lib/concurrent/edge/throttle.rb', line 154

    def throttled_by(throttle, &throttled_futures)
      a_trigger = self & self.chain { throttle.trigger }.flat_event
      throttled_futures.call(a_trigger).on_resolution! { throttle.release }
    end