Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
funasr_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f89ceb81
authored
Mar 21, 2024
by
‘chizw’
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]多进程优化
1 parent
53452b8e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
3 deletions
kafka_service/funasr_consumer.py
kafka_service/funasr_consumer.py
View file @
f89ceb8
...
@@ -104,7 +104,7 @@ def multi_thread_consumer():
...
@@ -104,7 +104,7 @@ def multi_thread_consumer():
process_pool
=
multiprocessing
.
Pool
(
processes
=
2
)
process_pool
=
multiprocessing
.
Pool
(
processes
=
2
)
#
process_pool.start()
process_pool
.
start
()
# 循环消费消息
# 循环消费消息
def
consume_kafka
():
def
consume_kafka
():
...
@@ -118,8 +118,6 @@ def consume_kafka():
...
@@ -118,8 +118,6 @@ def consume_kafka():
# 处理逻辑
# 处理逻辑
# funasr_service.handle_process(str(message.value.decode('utf-8')))
# funasr_service.handle_process(str(message.value.decode('utf-8')))
process_pool
.
apply_async
(
funasr_service
.
handle_process
,
str
(
message
.
value
.
decode
(
'utf-8'
)))
process_pool
.
apply_async
(
funasr_service
.
handle_process
,
str
(
message
.
value
.
decode
(
'utf-8'
)))
# process_pool.close()
# process_pool.join()
print
(
"task handle"
)
print
(
"task handle"
)
process_pool
.
close
()
process_pool
.
close
()
process_pool
.
join
()
process_pool
.
join
()
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment