consolidated redis ping

This commit is contained in:
Ilan
2015-08-17 14:25:32 +02:00
parent 47a92f8e56
commit ac2dc02b4c
2 changed files with 3 additions and 9 deletions

View File

@@ -33,16 +33,11 @@ import tasks
from django_q.conf import Conf, redis_client, logger, psutil
from django_q.models import Task, Success, Schedule
from django_q.monitor import Status, Stat
from django_q.monitor import Status, Stat, ping_redis
class Cluster(object):
def __init__(self, list_key=Conf.Q_LIST):
try:
redis_client.ping()
except Exception as e:
logger.exception(e)
raise e
self.sentinel = None
self.stop_event = None
self.start_event = None
@@ -136,6 +131,7 @@ class Sentinel(object):
self.start()
def start(self):
ping_redis(self.r)
self.spawn_cluster()
self.guard()

View File

@@ -278,7 +278,5 @@ def ping_redis(r):
try:
r.ping()
except Exception as e:
term = Terminal()
print(term.red('Can not connect to Redis server.'))
logger.exception(e)
logger.error('Can not connect to Redis server.')
raise e