diff --git a/scripts/call_command.py b/scripts/call_command.py index 23bc122..08fa3da 100644 --- a/scripts/call_command.py +++ b/scripts/call_command.py @@ -114,7 +114,9 @@ def run(self): rv = int(str(ex)) except Exception as ex: rv = -1 - logger.error("exception: {}".format(ex), exc_info=True) + logger.error("{} exception: {}".format( + "daemon" if self.is_daemon else "cron", ex), + exc_info=True) finish = time.time() duration = finish - start @@ -124,6 +126,10 @@ def run(self): exit=(rv if rv and isinstance(rv, int) else 0)) if self.is_daemon: + if rv < 0: + self.metrics.flush() + break + self.pause(start) else: self.metrics.flush()