From 6a859982d0d9695eb37be16c392934b86a74db02 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Mon, 1 Feb 2021 19:15:37 +0000 Subject: [PATCH] make sure status is always set by finally block confusingly, some errs are not subclasses of Exception (things like sys.exit()). Lets make sure the status is always set so cronitor knows what to ping. --- app/cronitor.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/cronitor.py b/app/cronitor.py index 83a12f61f..0dc6804b1 100644 --- a/app/cronitor.py +++ b/app/cronitor.py @@ -38,13 +38,11 @@ def cronitor(task_name): @wraps(func) def inner_decorator(*args, **kwargs): ping_cronitor('run') + status = 'fail' try: ret = func(*args, **kwargs) status = 'complete' return ret - except Exception: - status = 'fail' - raise finally: ping_cronitor(status)