feat(新功能):
fix(修复bug): 手动断开mq连接 docs(文档变更): refactor(重构): test(增加测试):
This commit is contained in:
@@ -29,6 +29,9 @@ logger = logging.getLogger()
|
||||
|
||||
class PoseTransformService:
|
||||
def __init__(self, request_data):
|
||||
if DEBUG is False:
|
||||
self.connection = pika.BlockingConnection(pika.ConnectionParameters(**RABBITMQ_PARAMS))
|
||||
self.channel = self.connection.channel()
|
||||
self.grpc_client = grpcclient.InferenceServerClient(url=PT_MODEL_URL)
|
||||
self.redis_client = redis.StrictRedis(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB, decode_responses=True)
|
||||
self.category = "pose_transform"
|
||||
@@ -108,9 +111,8 @@ class PoseTransformService:
|
||||
finally:
|
||||
dict_pose_transform_data, str_pose_transform_data = self.read_tasks_status()
|
||||
if DEBUG is False:
|
||||
connection = pika.BlockingConnection(pika.ConnectionParameters(**RABBITMQ_PARAMS))
|
||||
channel = connection.channel()
|
||||
channel.basic_publish(exchange='', routing_key=PS_RABBITMQ_QUEUES, body=str_pose_transform_data)
|
||||
self.channel.basic_publish(exchange='', routing_key=PS_RABBITMQ_QUEUES, body=str_pose_transform_data)
|
||||
self.connection.close()
|
||||
logger.info(f" [x] Sent to: {PS_RABBITMQ_QUEUES} data:@@@@ {json.dumps(dict_pose_transform_data, indent=4)}")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user