Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node中使用mysql连接池poll,在select/query之后未释放连接? #70

Open
profoundsoul opened this issue Jul 19, 2019 · 2 comments

Comments

@profoundsoul
Copy link

在node环境中,该库mysql poll每次使用完select/query/update之类的操作,是否都需要释放连接?
例如:
db.select('table').then(function(res){
//优先release连接????
}).catch(function(err){
//优先release链接????
})
如果没有释放连接,是否连接资源一直被占用呢?还是有特殊的处理方式

@Mickxuanyuan
Copy link

在node环境中,该库mysql poll每次使用完select/query/update之类的操作,是否都需要释放连接?
例如:
db.select('table').then(function(res){
//优先release连接????
}).catch(function(err){
//优先release链接????
})
如果没有释放连接,是否连接资源一直被占用呢?还是有特殊的处理方式

今天刚好看到这个库,看到这个问题回答下,这个select是用的mysql.createPool(...).query封装的,而pool中的query等同于pool.getConnection() -> connection.query() -> connection.release() mysql
这个库官方说的,所以是释放了连接的。

@AntiMoron
Copy link
Contributor

AntiMoron commented Dec 15, 2022

去mysql上 show processlist; 始终都有对应的Process为NULL.
不过当链接数到8时候就不再增加了,会选一个做复用

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants