mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-02 21:48:12 +08:00
Monitor starts with pinging Redis.
This commit is contained in:
+7
-1
@@ -9,13 +9,19 @@ from django.utils import timezone
|
|||||||
from django.utils.translation import ugettext as _
|
from django.utils.translation import ugettext as _
|
||||||
|
|
||||||
# local
|
# local
|
||||||
from .conf import Conf, redis_client
|
from .conf import Conf, redis_client, logger
|
||||||
from .tasks import SignedPackage
|
from .tasks import SignedPackage
|
||||||
|
|
||||||
|
|
||||||
def monitor(run_once=False):
|
def monitor(run_once=False):
|
||||||
term = Terminal()
|
term = Terminal()
|
||||||
r = redis_client
|
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():
|
with term.fullscreen(), term.hidden_cursor(), term.cbreak():
|
||||||
val = None
|
val = None
|
||||||
start_width = int(term.width / 8)
|
start_width = int(term.width / 8)
|
||||||
|
|||||||
Reference in New Issue
Block a user