KeenClient-iOS
KeenClient-iOS copied to clipboard
Overhaul rate limited request handling
Only simple analysis and funnel handle a 429 rate-limiting response and 503 errors aren't handled at all.
The current model for the SDK is to just record a 4xx http return code, and ignore client query requests if a specific query has failed 10 times in the past 3600 seconds. This isn't really retry logic, but barring a client from continuing to make query requests until 3600 seconds have elapsed. It's also recording a per-query attempt, while the rate-limit applies to the entire project.
At a minimum, that logic should be updated to include all analysis types that fall into the rate-limited category here: https://keen.io/docs/api/#limits.
A more complete solution might be to implement something in the SDK to allow for automatic retry attempts by introducing a delay and retrying up to a certain number of times before failing back to the client.