class Prorate::Throttled

The Throttled exception gets raised when a throttle is triggered.

The exception carries additional attributes which can be used for error tracking and for creating a correct Retry-After HTTP header for a 429 response

Attributes

retry_in_seconds[R]

@attr [Integer] for how long the caller will be blocked, in seconds.

throttle_name[R]

@attr [String] the name of the throttle (like “shpongs-per-ip”).

Can be used to detect which throttle has fired when multiple
throttles are used within the same block.

Public Class Methods

new(throttle_name, try_again_in) click to toggle source
Calls superclass method
# File lib/prorate/throttled.rb, line 15
def initialize(throttle_name, try_again_in)
  @throttle_name = throttle_name
  @retry_in_seconds = try_again_in
  super("Throttled, please lower your temper and try again in #{retry_in_seconds} seconds")
end