Commit 8639dc87 by ‘chizw’

[+]进程池优化

1 parent 0ce695b6
...@@ -73,7 +73,7 @@ def consume_kafka(): ...@@ -73,7 +73,7 @@ def consume_kafka():
log.info(f"启动consume_kafka Thread name:{threading.current_thread().name}") log.info(f"启动consume_kafka Thread name:{threading.current_thread().name}")
# 消费消息并进行逻辑处理 # 消费消息并进行逻辑处理
try: try:
process_pool = multiprocessing.Pool(processes=1, initializer=consumer_process_init) process_pool = multiprocessing.Pool(processes=2, initializer=consumer_process_init)
for message in consumer_new: for message in consumer_new:
if message is None: if message is None:
continue continue
......
...@@ -91,7 +91,7 @@ def select_process_all_end(): ...@@ -91,7 +91,7 @@ def select_process_all_end():
def select_time_out_task(): def select_time_out_task():
sql = ( sql = (
"select id,task_id,file_url,task_status from ali_asr_model_res aamr where aamr.del_flag = 0 " "select id,task_id,file_url,task_status from ali_asr_model_res aamr where aamr.del_flag = 0 "
"and aamr.output_data is null and aamr.execute_process_name is not null and exception_limit < 3" "and aamr.output_data is null and aamr.execute_process_name is not null and exception_limit < 3 "
"and aamr.updated_time < TIMESTAMPADD(MINUTE, -%s, NOW());" "and aamr.updated_time < TIMESTAMPADD(MINUTE, -%s, NOW());"
) )
return pool.select_all(sql, (30)) return pool.select_all(sql, (30))
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!