Exception: Legion::Extensions::MicrosoftTeams::Errors::Throttled
- Inherits:
-
StandardError
- Object
- StandardError
- Legion::Extensions::MicrosoftTeams::Errors::Throttled
- Defined in:
- lib/legion/extensions/microsoft_teams/errors.rb
Overview
Raised when Microsoft Graph (or the Bot Framework) throttles the caller and the retry policy has been exhausted, or when an actor wants to surface a throttle event without retrying further.
‘retry_after` carries the last advertised Retry-After interval (in seconds) as parsed from the upstream header. **It is nil when the server returned no Retry-After header or one we could not parse** — callers must check `retry_after_known?` before treating the value as a server directive. Conflating “header missing” with “retry immediately” was the bug the original fleet outage exposed.
Instance Attribute Summary collapse
-
#attempts ⇒ Object
readonly
Returns the value of attribute attempts.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#retry_after ⇒ Object
readonly
Returns the value of attribute retry_after.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status:, retry_after: nil, request: nil, attempts: nil) ⇒ Throttled
constructor
A new instance of Throttled.
-
#retry_after_known? ⇒ Boolean
True when the upstream advised a specific wait interval; false when the header was missing or unparseable.
Constructor Details
#initialize(status:, retry_after: nil, request: nil, attempts: nil) ⇒ Throttled
Returns a new instance of Throttled.
26 27 28 29 30 31 32 |
# File 'lib/legion/extensions/microsoft_teams/errors.rb', line 26 def initialize(status:, retry_after: nil, request: nil, attempts: nil) @status = coerce_status(status) @retry_after = coerce_retry_after(retry_after) @request = request @attempts = attempts.nil? ? nil : Integer(attempts) super() end |
Instance Attribute Details
#attempts ⇒ Object (readonly)
Returns the value of attribute attempts.
18 19 20 |
# File 'lib/legion/extensions/microsoft_teams/errors.rb', line 18 def attempts @attempts end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
18 19 20 |
# File 'lib/legion/extensions/microsoft_teams/errors.rb', line 18 def request @request end |
#retry_after ⇒ Object (readonly)
Returns the value of attribute retry_after.
18 19 20 |
# File 'lib/legion/extensions/microsoft_teams/errors.rb', line 18 def retry_after @retry_after end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
18 19 20 |
# File 'lib/legion/extensions/microsoft_teams/errors.rb', line 18 def status @status end |
Instance Method Details
#retry_after_known? ⇒ Boolean
Returns true when the upstream advised a specific wait interval; false when the header was missing or unparseable. Use this to decide whether to honor the wait verbatim or apply a local policy default before re-scheduling.
38 39 40 |
# File 'lib/legion/extensions/microsoft_teams/errors.rb', line 38 def retry_after_known? !@retry_after.nil? end |