Exception: Forem::RateLimitError
- Inherits:
-
ForemError
- Object
- StandardError
- ForemError
- Forem::RateLimitError
- Defined in:
- lib/forem/errors.rb
Overview
Raised when the server responds with HTTP 429 Too Many Requests.
The client has exceeded its request quota. The library will automatically
retry rate-limited requests up to Configuration#max_network_retries
times, honoring integer Retry-After seconds when supplied and otherwise
using exponential back-off.
Instance Attribute Summary
Attributes inherited from ForemError
#code, #http_body, #http_headers, #http_status
Instance Method Summary collapse
-
#retry_after ⇒ Integer?
Return the number of seconds requested by the server before retrying.
Methods inherited from ForemError
Constructor Details
This class inherits a constructor from Forem::ForemError
Instance Method Details
#retry_after ⇒ Integer?
Return the number of seconds requested by the server before retrying.
100 101 102 103 |
# File 'lib/forem/errors.rb', line 100 def retry_after value = http_headers&.fetch("retry-after", nil) Integer(value, 10) if value.is_a?(String) && value.match?(/\A[0-9]+\z/) end |