From e0a92d2b24347dfadff6af53da2ab170e2e8ca38 Mon Sep 17 00:00:00 2001 From: Ilan Steemers Date: Fri, 3 Jul 2015 16:57:26 +0200 Subject: [PATCH] Monitor starts with pinging Redis. --- django_q/monitor.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/django_q/monitor.py b/django_q/monitor.py index 3e678b9..e005537 100644 --- a/django_q/monitor.py +++ b/django_q/monitor.py @@ -9,13 +9,19 @@ from django.utils import timezone from django.utils.translation import ugettext as _ # local -from .conf import Conf, redis_client +from .conf import Conf, redis_client, logger from .tasks import SignedPackage def monitor(run_once=False): term = Terminal() r = redis_client + try: + redis_client.ping() + except Exception as e: + print(term.red('Can not connect to Redis server.')) + logger.exception(e) + return with term.fullscreen(), term.hidden_cursor(), term.cbreak(): val = None start_width = int(term.width / 8)