Skip to content
This repository has been archived by the owner on Jul 6, 2018. It is now read-only.

Add X-RateLimit-* headers to 429 responses #41

Closed
pmatseykanets opened this issue Apr 24, 2018 · 3 comments
Closed

Add X-RateLimit-* headers to 429 responses #41

pmatseykanets opened this issue Apr 24, 2018 · 3 comments

Comments

@pmatseykanets
Copy link

I'd suggest considering adding X-RateLimit-* headers to 429 responses to help automatically taking corrective measures and stopping hammering the API unnecessarily.

Of course there are different ways to go about it. I.e.

  • X-RateLimit-Limit - Request limit per time window
  • X-RateLimit-Remaining - The number of requests left for the time window window
  • X-RateLimit-Reset - The remaining window before the rate limit resets in UTC epoch seconds

Thanks for consideration and a great service!

@s32x
Copy link
Contributor

s32x commented Apr 24, 2018

I read about this recently and the thought crossed my mind. Since then I've completely forgotten. Thanks for reminding me I'll do my best to take care of adding that tonight!

@s32x
Copy link
Contributor

s32x commented Apr 25, 2018

Again thanks for the suggestion! I've taken care of implementing it on the public API!

Note: You may notice the rate limit acting slightly inconsistent on the public endpoints since we have multiple instances running and are only storing the data in a local map. I'll be adding Redis to account for this soon it's just not as high on my priority list.

@pmatseykanets
Copy link
Author

Thank you so much for such a quick turnaround. I'll take for a spin soon.

And of course Redis or any other centralized storage is essential to properly keep track of limits. Hopefully you'll be able to add it soon.

Thanks again.

@s32x s32x closed this as completed Apr 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants