From 2156e0f51a789a1381a69babeb97c1723ec1010c Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 19 Mar 2018 16:24:50 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E4=BF=AE=E6=94=B9jms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jms | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/jms b/jms index 0613e6287..08505cc17 100755 --- a/jms +++ b/jms @@ -29,6 +29,7 @@ HTTP_PORT = CONFIG.HTTP_LISTEN_PORT or 8080 DEBUG = CONFIG.DEBUG LOG_LEVEL = CONFIG.LOG_LEVEL +START_TIMEOUT = 15 WORKERS = 4 DAEMON = False @@ -214,11 +215,16 @@ def start_service(s): p = func() processes.append(p) - time.sleep(5) + now = int(time.time()) for i in services_set: - if not is_running(i): - print("Error: {} start error".format(i)) - stop_multi_services(services_set) + while not is_running(i): + if int(time.time()) - now < START_TIMEOUT: + time.sleep(1) + continue + else: + print("Error: {} start error".format(i)) + stop_multi_services(services_set) + return stop_event = threading.Event()