class ExcessFlow::ThrottledExecutor

ExcessFlow::ThrottledExecutor

Wrapper service class that will take care of initialization of configuration object and will execute on correct throttling strategy.

Attributes

args[R]

Public Class Methods

new(args) click to toggle source
# File lib/excess_flow/throttled_executor.rb, line 29
def initialize(args)
  @args = args
end
select_strategy_and_execute(args, &block) click to toggle source
# File lib/excess_flow/throttled_executor.rb, line 25
def self.select_strategy_and_execute(args, &block)
  new(args).select_strategy_and_execute(&block)
end

Public Instance Methods

select_strategy_and_execute(&block) click to toggle source
# File lib/excess_flow/throttled_executor.rb, line 33
def select_strategy_and_execute(&block)
  strategy.execute(configuration: configuration, &block)
end

Private Instance Methods

configuration() click to toggle source
# File lib/excess_flow/throttled_executor.rb, line 39
def configuration
  @configuration ||= ExcessFlow::ThrottleConfiguration.new(args)
end
strategy() click to toggle source
# File lib/excess_flow/throttled_executor.rb, line 43
def strategy
  configuration.strategy
end