After a certain number of sequential requests made in short bursts (normally around 180 requests but I managed to get it down to 50 if the first batch of more than 180 requests succeeds) respecting the API throttle (only 10 concurrent requests with a delay of 1.1 seconds between each batch), the API, seemingly with a random chance, returns an empty response with CORS headers not set resulting, obviously, in a CORS error for the client application.
Here is a screenshot of the error happening after 176 requests:
And here is one of the errors happening after 50 requests:
And here is some info about the error response that follows a normal one:
|Response headers||cache-control: no-cache
|API key provided?||Yes|
|Free daily quota||more than 8500 as per the last successful request|
At no point before the error occurs a
backoff field is returned but that shouldn't have mattered either way because the code I first reproduced this on was set up to properly handle encountering
backoff in a given response. It should also be mentioned that according to the API docs, making less than 30 requests in a second should be fine (however, the reproducing code was specifically designed to only make 10 requests per second):
If a single IP is making more than 30 requests a second, new requests will be dropped.
A very similar set of issues were reported before, and some were even supposed to be fixed:
See this MSO answer of mine for the code that reproduces the error (user id
674039 will result in 191 requests to make) - if it succeeds on the first try, rerun it, and you will likely get the error much earlier (please be weary of your daily API quota if you are a userscript user).
Can this be looked into?
GM.*API specific functions (that is annoying that one has to resort to that, but it's the reality of things here, I guess), but alas, this is not about making something of mine work but rather about drawing attention to an undefined behavior of the API. Methinks API consumers should expect to get the same response every time they go "by the book".