|
|
@@ -1,6 +1,9 @@
|
|
|
import logging
|
|
|
import tomllib
|
|
|
import json
|
|
|
+import os
|
|
|
+import sys
|
|
|
+
|
|
|
import pika
|
|
|
from redis.cluster import RedisCluster
|
|
|
from types import SimpleNamespace
|
|
|
@@ -10,6 +13,13 @@ from .worker import handle_message
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
+def is_stopped():
|
|
|
+ f = ".stop"
|
|
|
+ logger.warning("file %s exists, will be exit", f)
|
|
|
+ if os.path.exists(f):
|
|
|
+ sys.exit(0)
|
|
|
+
|
|
|
+
|
|
|
def open_redis_cluster(config):
|
|
|
cli = RedisCluster(host=config['host'], port=config['port'])
|
|
|
logger.debug("%s", cli.get_nodes())
|