Getting 429 errors before the x-ratelimit-remaining header runs out

Hey :slight_smile:

We tried to validate the rate limit headers on one of the login endpoints (/oauth/token), and found that we get 429 errors before the value for the x-ratelimit-remaining header would turn to 0 - it did not go below 89 from the initial value of 100.
Based on the received remaining header alone, I think we should have had all requests return 200.
Can you please clarify how we should track our remaining quota?

Test details:
We fired 21 requests at the endpoint at the same time, repeating them 2 times in total. We added a 61 second wait between the two batches, that you can also see in the timestamps. The test was conducted on a paid, production environment.

We logged the following information in order:
Unix timestamp in seconds #batch/request: status code - status message - value of x-ratelimit-limit - value of x-ratelimit-remaining - value of x-ratelimit-reset

–batchSize=21,–batchDelay=61000,–attempts=2,–file=./logs.txt
1615466334 #1/1: 200 - OK - limit: 100 - remaining: 99 - reset: 1615467199
1615466334 #1/6: 429 - Too Many Requests - limit: 10 - remaining: 0 - reset: 0
1615466334 #1/7: 200 - OK - limit: 100 - remaining: 98 - reset: 1615468063
1615466334 #1/10: 200 - OK - limit: 100 - remaining: 94 - reset: 1615471519
1615466334 #1/11: 200 - OK - limit: 100 - remaining: 95 - reset: 1615470655
1615466334 #1/13: 200 - OK - limit: 100 - remaining: 93 - reset: 1615472383
1615466334 #1/2: 200 - OK - limit: 100 - remaining: 97 - reset: 1615468927
1615466334 #1/9: 200 - OK - limit: 100 - remaining: 96 - reset: 1615469791
1615466334 #1/12: 200 - OK - limit: 100 - remaining: 92 - reset: 1615473247
1615466334 #1/14: 200 - OK - limit: 100 - remaining: 91 - reset: 1615474111
1615466334 #1/16: 200 - OK - limit: 100 - remaining: 89 - reset: 1615475839
1615466334 #1/15: 200 - OK - limit: 100 - remaining: 90 - reset: 1615474975
1615466334 #1/5: 200 - OK - limit: 100 - remaining: 90 - reset: 1615474975
1615466334 #1/17: 200 - OK - limit: 100 - remaining: 88 - reset: 1615476703
1615466334 #1/18: 200 - OK - limit: 100 - remaining: 89 - reset: 1615475839
1615466334 #1/19: 200 - OK - limit: 100 - remaining: 91 - reset: 1615474111
1615466334 #1/21: 429 - Too Many Requests - limit: 1000000 - remaining: 999999 - reset: 1615466335
1615466334 #1/3: 200 - OK - limit: 100 - remaining: 93 - reset: 1615472383
1615466334 #1/4: 200 - OK - limit: 100 - remaining: 93 - reset: 1615472383
1615466334 #1/8: 200 - OK - limit: 100 - remaining: 95 - reset: 1615470655
1615466334 #1/20: 200 - OK - limit: 100 - remaining: 95 - reset: 1615470655
1615466396 #2/5: 200 - OK - limit: 100 - remaining: 99 - reset: 1615467260
1615466396 #2/4: 200 - OK - limit: 100 - remaining: 98 - reset: 1615468125
1615466396 #2/12: 429 - Too Many Requests - limit: 1000000 - remaining: 999999 - reset: 1615466397
1615466396 #2/13: 429 - Too Many Requests - limit: 1000000 - remaining: 999999 - reset: 1615466397
1615466396 #2/6: 200 - OK - limit: 100 - remaining: 97 - reset: 1615468989
1615466396 #2/14: 429 - Too Many Requests - limit: 1000000 - remaining: 999999 - reset: 1615466397
1615466396 #2/9: 200 - OK - limit: 100 - remaining: 96 - reset: 1615469853
1615466396 #2/15: 429 - Too Many Requests - limit: 1000000 - remaining: 999999 - reset: 1615466397
1615466396 #2/7: 200 - OK - limit: 100 - remaining: 95 - reset: 1615470717
1615466396 #2/8: 200 - OK - limit: 100 - remaining: 93 - reset: 1615472445
1615466396 #2/16: 429 - Too Many Requests - limit: 1000000 - remaining: 999999 - reset: 1615466397
1615466396 #2/10: 200 - OK - limit: 100 - remaining: 94 - reset: 1615471581
1615466396 #2/17: 429 - Too Many Requests - limit: 1000000 - remaining: 999999 - reset: 1615466397
1615466396 #2/11: 200 - OK - limit: 100 - remaining: 92 - reset: 1615473309
1615466396 #2/2: 200 - OK - limit: 100 - remaining: 92 - reset: 1615473309
1615466396 #2/18: 429 - Too Many Requests - limit: 1000000 - remaining: 999999 - reset: 1615466397
1615466396 #2/3: 200 - OK - limit: 100 - remaining: 91 - reset: 1615474173
1615466396 #2/20: 429 - Too Many Requests - limit: 1000000 - remaining: 999999 - reset: 1615466397
1615466396 #2/19: 429 - Too Many Requests - limit: 1000000 - remaining: 999999 - reset: 1615466397
1615466396 #2/21: 429 - Too Many Requests - limit: 1000000 - remaining: 999999 - reset: 1615466397
1615466396 #2/1: 429 - Too Many Requests - limit: 1000000 - remaining: 999999 - reset: 1615466397