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

Closing unused pool connection #1748

Open
miningpoolhub opened this issue Jun 6, 2017 · 3 comments
Open

Closing unused pool connection #1748

miningpoolhub opened this issue Jun 6, 2017 · 3 comments

Comments

@miningpoolhub
Copy link

Hi
I've found that mysql pool connection is working well, but it really doesn't close connection even long time unused.
If there any API or trick to close unused connections in the pool?

I usually initialize pool by

mysql.createPool({
connectionLimit: someNumber
}

And I use

pool.query()

to query some data.

If there's no API for it, it would be good to have some flush() function to close idle connections.

@dougwilson
Copy link
Member

Hi @miningpoolhub there is no API in the pool to close an idling connection, partly by design to keep the connection open as long as possible, since you should be sizing the pool for your load, you want the connections to stay open for when load returns. It also helps you spot when you have configured too many pools to open more connections than your server is willing to handle very quickly.

@miningpoolhub
Copy link
Author

@dougwilson Thanks!

@sidorares
Copy link
Member

there is pending #1749 that adds this (also #962 tracking this)

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

No branches or pull requests

3 participants