polling icon indicating copy to clipboard operation
polling copied to clipboard

Sleeps after last unsuccessful call to target before raising MaxCallException

Open troyhoffman opened this issue 6 years ago • 4 comments

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.

troyhoffman avatar Oct 11 '18 17:10 troyhoffman

Pull request created (https://github.com/justiniso/polling/pull/12)

troyhoffman avatar Oct 11 '18 17:10 troyhoffman

My PR was failing CI. Looking into this, since it passed the tests locally.

troyhoffman avatar Oct 11 '18 17:10 troyhoffman

This has been fixed in https://pypi.org/project/polling2/

ddmee avatar Jun 04 '19 18:06 ddmee

@justiniso are you going to address this issue?

VeNoMouS avatar Mar 03 '20 20:03 VeNoMouS