Commit 103e4fa0 authored by Jonathan Michalon's avatar Jonathan Michalon

Fix "retry" algorithm from b4n MR which is not exactly the same as "every"

"every" is a loop, meaning that it always has to rotate back to
the begining when the threshold is met. But retry is more like a
ceiling, menaning that after the threshold it is "too much".
So modulo is perfect for "every" and for "retry", use min().
parent 84118543
......@@ -45,11 +45,12 @@ class Check(object):
if self.every_count == 0 or immediate:
self.setup()
if not self.check():
self.retry_count = (self.retry_count + 1) % (self.retry + 1)
if self.retry_count == 0 or immediate:
self.retry_count = min(self.retry_count + 1, self.retry)
if self.retry_count == self.retry or immediate:
self.ok = False
else:
self.ok = True
self.retry_count = 0
self.teardown()
return self.ok
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment