DEV Community

Discussion on: How to handle API downtime with 2 lines of code

Collapse
 
frenchcooc profile image
Corentin

Your API calls remains the same when you enable the Agent on your app. So if an API changes the endpoints or release a new version, you will have to updates your code accordingly.

On-the-fly changing your requests is something that we think about, but it has to be very carefully built (and tested) before being production-ready 😇

Collapse
 
ionline247 profile image
Matthew Bramer

So the request would continue to reach out over the wire, making the same API call over and over again? How could I stop the retry cycle?

Thread Thread
 
frenchcooc profile image
Corentin

A retry-mechanism needs some limit, otherwise, you enter an infinite loop indeed. One retry seems good enough in most cases.

But you also need to take into account a period of time. If you are making 100 API calls per minute to the same API, you can safely consider that if a certain amount is failing, all the others will fail. What you would need here is a circuit breaker (and it's also a feature that we are actively working on at Bearer).