Exception: VisionAPI::RateLimitError
- Defined in:
- lib/vision_api/errors.rb
Overview
429 — sleep for #retry_after seconds. Do not invent a backoff.
Direct Known Subclasses
Constant Summary
Constants inherited from APIError
Instance Attribute Summary
Attributes inherited from APIError
#code, #details, #headers, #request_id, #status
Instance Method Summary collapse
-
#retry_after ⇒ Float
The server's own number, in seconds.
Methods inherited from APIError
Constructor Details
This class inherits a constructor from VisionAPI::APIError
Instance Method Details
#retry_after ⇒ Float
Returns the server's own number, in seconds. Honor it rather than guessing.
94 95 96 97 98 99 100 101 102 103 |
# File 'lib/vision_api/errors.rb', line 94 def retry_after header = headers["retry-after"] value = header.to_f if header return value if value&.positive? detail = details["retry_after"] return detail.to_f if detail.is_a?(Numeric) && detail.positive? 2.0 end |