backoff
backoff copied to clipboard
README: `max_value` arg to `@backoff.on_predicate(backoff.fibo...)` -- if not obsolete, then maybe just confusing?
As a first-time user of backoff I tried decorating with a slight variation of the example in the README:
@backoff.on_predicate(backoff.fibo, lambda x: x != "SUCCEEDED", max_value=13)
My decorated function, a stub that would always fail, kept getting retried in an endless loop. From the source for _on_predicate
it sure appears to want max_tries
or max_time
instead.
And I am willing to put in a PR, except that the text of the README sounds like this isn't an accident:
Extra keyword arguments are passed when initializing the wait generator, so the max_value param above is passed as a keyword arg when initializing the fibo generator.
Well, I see the fibo generator in the code wants max_value
, but it didn't work for me out of the box. I didn't debug far enough to see if it gets passed through, but it didn't seem to stop execution for several minutes.
In any event this feature seems to require some additional understanding to be used out of the box. Would it be valuable to demonstrate simpler uses of fibo to start (with max_tries
and max_time
) and then, as appropriate, build up to this trickier (at least for me) usage?