polling
polling copied to clipboard
Sleeps after last unsuccessful call to target before raising MaxCallException
Example code: ``def target_method(): print('called') return False
poll(target_method, step=5, max_tries=2)``
Behavior: Prints "called", waits 5 seconds, prints "called", waits 5 seconds, raises polling.MaxCallException
Expected: Prints "called", waits 5 seconds, prints "called", raises polling.MaxCallException immediately
The problem will be more noticeable with a high step value. With a step value of 300, it will wait 5 minutes between failing and raising the exception. Fix is to move the check and raise to before the sleep instead of the top of the loop.
Pull request created (https://github.com/justiniso/polling/pull/12)
My PR was failing CI. Looking into this, since it passed the tests locally.
This has been fixed in https://pypi.org/project/polling2/
@justiniso are you going to address this issue?