Chris Bolton
Chris Bolton

Reputation: 2926

Rescuing from failed api calls

So I have an api fetch in my app where once in awhile it'll fail and give out a 500 internal server error which is just fixed with a refresh, but how do I rescue rails from this situation and just have it wait to load the page until the api call is successful?

Upvotes: 1

Views: 177

Answers (1)

apneadiving
apneadiving

Reputation: 115521

Have a look at this great retryable method: link.

Note you can customize it with a sleep to pause between two requests.

Upvotes: 2

Related Questions