twilight icon indicating copy to clipboard operation
twilight copied to clipboard

Support `X-Ratelimit-Scope`

Open Gelbpunkt opened this issue 3 years ago • 4 comments

Parse X-Ratelimit-Scope in response headers and deal with it accordingly. For now I suggest we simply ignore shared ratelimits, because we can't know whether our timer is still accurate.

  • [x] support parsing header (#1351)
  • [ ] use retry-after on shared ratelimits

Docs: https://github.com/discord/discord-api-docs/commit/60a0e3d99d014fa9036a1d30b0d2ac8ec7bfb987

Gelbpunkt avatar Nov 09 '21 06:11 Gelbpunkt

i don't see how ignoring them makes any sense? we only get the header if we got rate limited, and thus it will give us the correct time to wait then. the rest of the headers still returns the regular rate limit

AEnterprise avatar Nov 09 '21 07:11 AEnterprise

You're right, we should still respect it.

Gelbpunkt avatar Nov 09 '21 09:11 Gelbpunkt

According to devsnek this header can just be ignored: https://github.com/discord/discord-api-docs/pull/4013#issuecomment-954341664

itohatweb avatar Nov 21 '21 11:11 itohatweb

it can be ignored but exposing it can still be useful to downstream consumers and especially debugging http proxy rate limit issues to know if the limit we hit could/should have been avoided or not

AEnterprise avatar Nov 21 '21 20:11 AEnterprise