retriable
retriable copied to clipboard
Allow unlimited tries
So I'm dumb and am only now realizing a PR (#20) already exists for this, but as it's 4+ years old and is based on an older version of the code, maybe this is worth it anyway.
As noted in #20, implementing this requires the use of Enumerator
s because the ExponentialBackoff
class currently produces an array, which is no longer feasible.
Thoughts/comments/criticism very welcome.
Note: Fixes #94. Obviously fixes #20 as well.
Update: Apparently this is failing now due to the Gemfile.lock
so I need to unravel that. Also, hound is failing because it is invoking rubocop
instead of bundle exec rubocop
so it's running against a newer version. But newer versions encourage constructs (i.e. safe navigation operator) not supported in all of 2.x. Will see if I can get this working. (Complicating matters is that 2.0 will no longer compile on my version of Ubuntu.)
@mvastola Can I ask what's the use case for needing or wanting unlimited retries? This change will change the API enough that it would likely need a major release. Unlimited tries is not something I'd ever use, especially with exponential backoff as that interval could get so long between tries. When would you not want it to eventually give up? It just seems like it could be dangerous to retry infinitely.
When would you not want it to eventually give up?
Any service depending on another service that may go down for undefined amount of time. Like when some websites break the API and aren't hurrying to fix it and my bots deployed once in a year would like to wait until it works again instead of halting and doubling their offline time by waiting for me to restart them.