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 f1f583b4
authored
Mar 22, 2024
by
‘chizw’
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]代码优化
1 parent
5735fb4f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
37 deletions
kafka_service/funasr_consumer.py
kafka_service/funasr_consumer.py
View file @
f1f583b
...
@@ -19,43 +19,6 @@ consumer_new = KafkaConsumer(
...
@@ -19,43 +19,6 @@ consumer_new = KafkaConsumer(
)
)
log
.
info
(
"启动2"
)
log
.
info
(
"启动2"
)
# 创建连接池对象
connection_pool
=
pooling
.
MySQLConnectionPool
(
pool_name
=
"mypool"
,
pool_size
=
32
,
pool_reset_session
=
True
,
host
=
ConfigInfo
.
host
,
port
=
ConfigInfo
.
port
,
database
=
ConfigInfo
.
database
,
user
=
ConfigInfo
.
user
,
password
=
ConfigInfo
.
password
,
autocommit
=
True
,
)
log
.
info
(
"启动3"
)
# 从连接池获取连接
def
get_connection
():
log
.
info
(
"connection_pool size:"
+
str
(
connection_pool
.
_cnx_queue
.
qsize
()))
# 从连接池获取连接
return
connection_pool
.
get_connection
()
def
execute_sql
(
sql
):
try
:
conn
=
get_connection
()
cursor
=
conn
.
cursor
()
cursor
.
execute
(
sql
)
conn
.
commit
()
log
.
info
(
"sql 执行结束"
)
except
Exception
as
msg
:
log
.
error
(
"sql执行Exception: "
+
str
(
msg
))
finally
:
cursor
.
close
()
conn
.
close
()
class
MultiThreadKafka
(
object
):
class
MultiThreadKafka
(
object
):
def
__init__
(
self
):
def
__init__
(
self
):
...
...
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