rholder / retrying

Retrying is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just about anything.
Apache License 2.0
1.91k stars 157 forks source link

Fixed a bug that ignored the default value of `stop_max_attempt_number` #74

Closed guyarad closed 1 week ago

guyarad commented 6 years ago

Seems like the default value of stop_max_attempt_number is ignored, resulting in infinite retries. If this was intentional, this whole PR should be rejected. Otherwise that's a bug.

I also fixed the tests. For example, NoneReturnUntilAfterCount, given some count will actually return None for count times, and succeed only on the count+1 invocation. If the default is now being taken into account, you need to pass '4' and not '5' as being done in many tests.

NOTE: I have added some questions inlined with the code. Obviously I'll remove it, but wanted to discuss them with you.

Enjoy :)