Class: EbDeployer::ThrottlingHandling

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/eb_deployer/throttling_handling.rb

Constant Summary

Constants included from Utils

Utils::BACKOFF_INITIAL_SLEEP

Instance Method Summary collapse

Methods included from Utils

#backoff, #reject_nil, #symbolize_keys

Constructor Details

#initialize(delegatee, throttling_error) ⇒ ThrottlingHandling

Returns a new instance of ThrottlingHandling.



5
6
7
8
# File 'lib/eb_deployer/throttling_handling.rb', line 5

def initialize(delegatee, throttling_error)
  @delegatee = delegatee
  @throttling_error = throttling_error
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



10
11
12
13
14
15
# File 'lib/eb_deployer/throttling_handling.rb', line 10

def method_missing(method, *args, &block)
  super unless @delegatee.respond_to?(method)
  backoff(@throttling_error) do
    @delegatee.send(method, *args, &block)
  end
end