LCS will start returning HTTP 429 Too Many Requests
richardsondev opened this issue · 3 comments
Hello 2LCS team,
I am with the Microsoft LCS team and wanted to let you know about changes we are making soon. In an effort to ensure all clients gain fair access to LCS, we will start rate limiting endpoints on a per endpoint basis by several levels including User, Project, and User Organization. We will start rejecting requests with HTTP 429 (Too Many Requests) if we see a request that crosses the threshold for any of the previous defined scopes. These limits will be set with high limits but in cases where thousands of requests come in within a minute, the client should expected to be throttled and see HTTP 429 from LCS. As time goes on, we plan on adding rate limiting to all major endpoints in LCS.
When LCS rejects a request with Too Many Requests, we will also return a "retry-after" header which will denote the length of time in seconds the client should wait before trying the operation again. In many cases, adding a wait with this number will correctly handle the rate limiting.
Example response code and common headers
HTTP 429
retry-after: 5
activity-id: xxxxxx-xxxxx-xxxxx
My suggestion for your team is to ensure 2LCS can handle 429 responses from LCS and at least show a proper error message to the user before we start rolling this out to more endpoints. If you see fit, you could add a retry that retries the request after the "retry-after" header time which could gracefully handle the 429s.
Please let me know if you have any questions. We could setup a test endpoint in LCS for you to validate the logic in 2LCS to validate it handles the 429s correctly.
This isn't an urgent priority but know that in the future, LCS will return 429s more often which could affect 2LCS.
Regards,
Billy Richardson
LCS team
EDIT: Clarified that "Retry-After" header will be lowercase like "retry-after"
Great writeup @richardsondev thanks for the heads up. Would be great to have more documentation around how to access the apis, I guess this is also coming up, exciting!
@TomekMelissa I believe we could close this issue?
@fraga Thanks for the hint.
@TomekMelissa Closed the issue, feel free to reopen it.