I'm using the mysql2 node package (v1.2.0) in a web application and when I'm stepping through the code using the debbugger (using webstorm), if I sit too long at certain breakpoints, initiating the connection will sometimes time out.
Here's the message I receive when it times out:
Error: connect ETIMEDOUT
at Connection._handleTimeoutError (/Volumes/github-image/bitcoin-core/node_modules/mysql2/lib/connection.js:179:13)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
I was hoping to increase the timeout to avoid this issue. I tried adding a custom timeout value for when the connection is set up.
export const connection = mysql.createConnection({
host: dbHost,
user: dbUser,
password: dbPassword,
database: dbName,
timeout: 60000
});
But this had no effect.
If the timeout is on the client, the property for the connection timeout is connectTimeout, not just timeout. The documentation for the (compatible) mysql package reads:
connectTimeout: The milliseconds before a timeout occurs during the initial connection to the MySQL server. (Default:10000)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With