Affected Product
Which product does this bug affect?
API
Describe the bug
I'm infrequently receiving a 429 error from the API that reports a limit of 10 instead of 100. For example, "429: Too Many Requests: Rate limit exceeded: 24 of 10 requests per 20 seconds". Most API requests are successful.
To Reproduce
For a church with over 30,000 people, quickly make API requests to the people endpoint, traversing the entire list of people. You'll need to back off on requests before you hit regular limits. See rough code below:
def calculate_wait(headers)
count = headers['x-pco-api-request-rate-count']
limit = headers['x-pco-api-request-rate-limit']
period = headers['x-pco-api-request-rate-period']
Rails.logger.info("count: #{count}, limit: #{limit}, period: #{period}") # for trouble-shooting
(count / limit.to_f) < 0.8 ? 0 : period.to_i
end
offset = 0
loop do
response = api_client.people(offset: offset, per_page: 100)
# wait so as to not run into API limits
sleep(calculate_wait(response.headers))
offset += 100
break if response.body['data'].empty?
end
Expected behavior
The API should not return 429 errors unless the x-pco-api-request-rate-count is greater than or equal to 100.
Screenshots
Additional Context:
- Endpoint: people/v2/people
- Language: Ruby on Rails
- Authentication: OAuth 2
Additional context
This error only appeared in the last 4 days or so.
I have..
Affected Product
Which product does this bug affect?
API
Describe the bug
I'm infrequently receiving a 429 error from the API that reports a limit of 10 instead of 100. For example, "429: Too Many Requests: Rate limit exceeded: 24 of 10 requests per 20 seconds". Most API requests are successful.
To Reproduce
For a church with over 30,000 people, quickly make API requests to the people endpoint, traversing the entire list of people. You'll need to back off on requests before you hit regular limits. See rough code below:
Expected behavior
The API should not return 429 errors unless the x-pco-api-request-rate-count is greater than or equal to 100.
Screenshots
Additional Context:
Additional context
This error only appeared in the last 4 days or so.
I have..