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