My app is using a third-party API. It polls that API regularly at several endpoints. In also makes some additional calls to the API based on user's interaction with the app. The API is very slow, most requests take well over a second. The API is very flaky - timeouts are common, 500 errors are common, session key often randomly expires (even when defined "keep_alive" endpoint is called regularly). There is no option to use another API.
What would be the best practices for dealing with such an API?
How to disable concurrent requests to this API on the requests level. So if one request is waiting for a response - the second request is not initiated? This should be done on "per-domain" basis, other requests to other domains should still be done concurrently.
Any other settings to toggle with requests to make it easier to deal with such an API?
What would be the best practices for dealing with such an API?
In SRE we pretty much always assume that API's can never be trusted, Because of this there are a number of patterns that may help:
References:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With