-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add idleConnectionTimeout to pool options #2218
base: master
Are you sure you want to change the base?
Conversation
This option is great,and when will it be released to the official edition?@@dougwilson |
I am working through this module prs and issues this week. |
lib/PoolConnection.js
Outdated
@@ -32,6 +32,13 @@ PoolConnection.prototype.release = function release() { | |||
return undefined; | |||
} | |||
|
|||
if (this._pool.config.idleConnectionTimeout) { | |||
this._idleTimeout = setTimeout( | |||
this.destroy.bind(this), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably end the connection gracefully, running the QUIT packet to the server instead of just dropping the TCP connection. Various database setups will block a client that keeps dropping TCP connections without properly closing them.
Use conn.end instead of conn.destroy for closing idle connections
@dicearr this would be ❤️ by many cloud users. Any plan to continue this PR? |
Hi @akleiber. After the review comment I tried to gracefully close the connection by using |
We use this library with aws aurora and idleConnectionTimeout is really needed. I don't really have time to wait for this ticket to be merged. What do you guys think about attaching a timer on connection 'release' event, which will close connection if it's not acquired after 'x' time, can be done on top of library. |
This is a temporary solution until this functionality has been merged. Place this right after importing the mysql library.
This is forward compatible. So what it does is patch the |
https://github.com/mysqljs/mysql/pull/2507/files Hello, everyone, I commit a pr and to solve this issue, any feedback would be appreciated. |
This option is specially useful when connecting to serverless databases, in which the instances are turned off when there is no connection alive.
Coming from #2195.
This aims to close #1276 and resolve #962.