From 13066990360af4c3768edb798816eb2fa2a2017b Mon Sep 17 00:00:00 2001 From: Fredrik Eriksson Date: Tue, 2 Jul 2019 17:30:33 +0200 Subject: [PATCH] potential fix for datetime calculation --- cronwrapper/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cronwrapper/__init__.py b/cronwrapper/__init__.py index 44a5b82..28df779 100755 --- a/cronwrapper/__init__.py +++ b/cronwrapper/__init__.py @@ -216,7 +216,7 @@ def main(): # Failure if previous_runs: # Not the first failure... - oldest = min(previous_runs.values()) + oldest = datetime.datetime.fromtimestamp(min(previous_runs.values())) if now-oldest > datetime.timedelta(seconds=args.warn_interval): # we have failed for a long time, send a report print("Cronjob is still failing after {} seconds ({} failures)\n".format(args.warn_interval, len(previous_runs)))