Closed thomashoneyman closed 1 year ago
I have copied the previous iteration of this code in Spago as I didn't want to depend on the Registry app, but maybe I should depend on it? Not sure if we'd like this in lib
I'd rather not put this in lib
because I'd like to be able to arbitrarily change it in the future. It could potentially go in foreign
(despite not really being a foreign binding) as Registry.Foreign.Aff
and be a collection of Aff utils or something. But I think the best thing is to copy it into Spago and tweak it to your needs.
There have been a few times in which I mistakenly assumed
withBackoff
would retry on failure, but that isn't correct: it sets a timeout and cancels the action if it exceeds the timeout, extending the timeout using exponential backoff on each cancellation.This PR renames
withBackoff
towithRetryOnTimeout
and introduces a new family ofwithRetry
functions that make it easier to retryAff
-based actions on failure. For example,withRetryRequest
lets you make an HTTP request and retry when the request succeeds but an error status code was returned.