Commit fec4da3f authored by Colomban Wendling's avatar Colomban Wendling

Fix retry count in recovery notifications

parent 9c58d8d6
......@@ -67,8 +67,8 @@ class Check(object):
self.setup()
if not self.check():
logging.debug('Fail: ' + str(self))
self.retry_count = min(self.retry_count + 1, self.retry)
if self.retry_count == self.retry or immediate:
self.retry_count += 1
if self.retry_count >= self.retry or immediate:
if self.ok:
logging.debug('Switched to failure: ' + str(self))
self.failure_date = datetime.now()
......
......@@ -105,7 +105,7 @@ def send_email_for_check(check):
delta = datetime.now() - check.failure_date
# remove microsec
delta = delta - timedelta(microseconds=delta.microseconds)
n = delta // timedelta(seconds=check.error_every * config.base_tick)
n = check.retry_count + 1 - check.retry
msg_text += ("recovered after %s (%d %s)." %
(delta, n, "retry" if n == 1 else "retries"))
else:
......
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