我在web應用程序中使用mysql2節點包(v1.2.0),並且當我使用debbugger(使用webstorm)遍歷代碼時,如果我坐在某些斷點處時間過長,有時會啓動連接時間到。節點應用程序:如何在debbuging時增加mysql2的超時時間?
這是我收到時超時消息:
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)
我希望增加超時,以避免此問題。我嘗試在連接建立時添加一個自定義超時值。
export const connection = mysql.createConnection({
host: dbHost,
user: dbUser,
password: dbPassword,
database: dbName,
timeout: 60000
});
但是這沒有效果。