Hi!
We are using Zendesk API to paginate over customers and seeing very strange behavior. Namely, we see that we have 2,500 API calls per minute, but we actually are able only to make about 10 API calls, and then next API call receives response to retry in 45-50 seconds.
Here is example log:
Rate limit remaining = 2498
Loading took: 5.170986580997123 sec.
Serialization proxy took: 0.022264 sec.
Rate limit remaining = 2497
Loading took: 0.9622471750044497 sec.
Serialization proxy took: 0.017576 sec.
Rate limit remaining = 2495
Loading took: 0.9119032159942435 sec.
Serialization proxy took: 0.027292 sec.
Rate limit remaining = 2493
Loading took: 0.921644258996821 sec.
Serialization proxy took: 0.026314 sec.
Rate limit remaining = 2492
Loading took: 0.9674966359962127 sec.
Serialization proxy took: 0.021140 sec.
Rate limit remaining = 2490
Loading took: 0.9632566619984573 sec.
Serialization proxy took: 0.026728 sec.
Rate limit remaining = 0
Got rate limit error with retry-after = 54
Going to sleep 54 second before retrying operation (3 left)
Rate limit remaining = 2498
Loading took: 55.1312586799977 sec.
Serialization proxy took: 0.020960 sec.
Rate limit remaining = 2496
Loading took: 0.9879554859944619 sec.
Serialization proxy took: 0.024193 sec.
Rate limit remaining = 2494
Loading took: 0.9300845250036218 sec.
Serialization proxy took: 0.025358 sec.
Rate limit remaining = 2492
Loading took: 0.9360590920041432 sec.
Serialization proxy took: 0.016378 sec.
Rate limit remaining = 2491
Loading took: 0.9270053250002093 sec.
Serialization proxy took: 0.020112 sec.
Rate limit remaining = 2490
Loading took: 0.9044810400009737 sec.
Serialization proxy took: 0.026616 sec.
Rate limit remaining = 0
Got rate limit error with retry-after = 54
Going to sleep 54 second before retrying operation (3 left)
Rate limit remaining = 2498
Loading took: 55.411540980996506 sec.
Serialization proxy took: 0.019995 sec.
Rate limit remaining = 2496
Loading took: 1.3348951139996643 sec.
Serialization proxy took: 0.017415 sec.
Rate limit remaining = 2495
Loading took: 0.9663326709996909 sec.
Serialization proxy took: 0.021108 sec.
Rate limit remaining = 2493
Loading took: 0.934547452001425 sec.
Serialization proxy took: 0.016983 sec.
Rate limit remaining = 2491
Loading took: 1.2381742600045982 sec.
Serialization proxy took: 0.025073 sec.
Rate limit remaining = 2490
Loading took: 0.9220151430054102 sec.
Serialization proxy took: 0.032461 sec.
Rate limit remaining = 0
Got rate limit error with retry-after = 53
Going to sleep 53 second before retrying operation (3 left)
Rate limit remaining = 2498
As you can see right after having a 2490 api quota - next API call (which happens next second) gets 429 response with retry-after header.
What could be the problem?
Thanks,
Anton
The
X-Rate-Limit-Remainingheader will return the number of requests left under your general account limit. But some endpoints have their own limit that allow a lower rate of requests than the account-level limit. For example, incremental export endpoints allow a maximum of 10 requests per minute.