|
@@ -3,9 +3,11 @@
|
|
|
# @Time: 2023/6/21
|
|
|
import argparse
|
|
|
import random
|
|
|
+import subprocess
|
|
|
from mq_http_sdk.mq_client import *
|
|
|
from mq_http_sdk.mq_consumer import *
|
|
|
from mq_http_sdk.mq_exception import MQExceptionBase
|
|
|
+
|
|
|
sys.path.append(os.getcwd())
|
|
|
from common.common import Common
|
|
|
from common.public import get_consumer, ack_message, task_fun_mq
|
|
@@ -13,6 +15,13 @@ from common.scheduling_db import MysqlHelper
|
|
|
from kanyikan.kanyikan_recommend.kanyikan_recommend0627 import KanyikanRecommend
|
|
|
|
|
|
|
|
|
+def restart_charles():
|
|
|
+ # 关闭 Charles
|
|
|
+ subprocess.run(["osascript", "-e", 'tell app "Charles" to quit'])
|
|
|
+ # 重启 Charles
|
|
|
+ subprocess.run(["open", "-a", "Charles"])
|
|
|
+
|
|
|
+
|
|
|
def main(log_type, crawler, topic_name, group_id, env):
|
|
|
consumer = get_consumer(topic_name, group_id)
|
|
|
# 长轮询表示如果Topic没有消息,则客户端请求会在服务端挂起3秒,3秒内如果有消息可以消费则立即返回响应。
|
|
@@ -31,6 +40,7 @@ def main(log_type, crawler, topic_name, group_id, env):
|
|
|
while True:
|
|
|
try:
|
|
|
# 长轮询消费消息。
|
|
|
+ restart_charles()
|
|
|
recv_msgs = consumer.consume_message(batch, wait_seconds)
|
|
|
for msg in recv_msgs:
|
|
|
Common.logger(log_type, crawler).info(f"Receive\n"
|