Microsoft Graph throttling Excel updates

2019-07-29 05:53发布

问题:

I am developing a Node.js app which connects to the Microsoft Graph API.

Often times, I get back a 429 status code, which is described as "Too Many Requests" in the error documentation.

Sometimes the message returned is:

TooManyRequests. Client application has been throttled and should not attempt to repeat the request until an amount of time has elapsed.

Other times, it returns:

"TooManyRequests. The server is busy. Please try again later.".

Unfortunately, it is not returning a Retry-After field in the headers, even though their best practices claims that it should do so.

This is entirely in development, and I have not been hitting the service much, as it has all been during debugging. I realize Microsoft is often changing how this works. I just find it difficult to develop an app around a service which does not even provide a Retry-After field, and seems to have a lot of problems (I am using the v1.0 endpoint).

When I wait 5 minutes (as I have seen recommended), the service still errors out. Here is an example return response:

{
    "error": {
        "code": "TooManyRequests",
        "message": "The server is busy. Please try again later.",
        "innerError": {
            "request-id": "d963bb00-6bdf-4d6b-87f9-973ef00de211",
            "date": "2017-08-31T23:09:32"
        }
    }
}

Could this relate at all to the operation being carried out?

I am updating a range from A2:L3533. They are all text values. I am wondering if this could impact the throttling. I have not found any guidance regarding using "smaller" operation sets.

回答1:

Without seeing your code, it is hard to diagnose exactly what is going on. That said, you're Range here is enormous and almost certainly will result in issues.

From the documentation:

Large Range implies a Range of a size that is too large for a single API call. Many factors such as number of cells, values, numberFormat, and formulas contained in the range can make the response so large that it becomes unsuitable for API interaction. The API makes a best attempt to return or write to the requested data. However, the large size involved might result in an API error condition because of the large resource utilization.

To avoid this, we recommend that you read or write for large Range in multiple smaller range sizes.