我在web应用程序中使用的是mysql2节点包(v1.2.0),当我使用debbugger (使用webstorm)遍历代码时,如果我在某些断点上坐得太久,启动连接有时会超时。
这是我在超时时收到的消息:
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 tryOnTime
events.js:141
throw er; // Unhandled 'error' event
MongoError: connection 0 to localhost:27017 timed out
at Function.MongoError.create (/home/ubuntu/scripts/node_modules/mongodb-core/lib/error.js:29:11)
at Socket.<anonymous> (/home/ubuntu/scripts/node_modules/mongodb-core/lib
如何在Node.js中增加域名解析超时时间?我正在尝试解析url,看看有什么是可用的,但很多请求都超时了,可能还会出现误报。
// checks a url string for availability and errors on 'err'
function checkAvailable( url ) {
dns.resolve4( url, function (err, addresses) {
if (err) console.log (url + " : " + err)
})
}
WARN: Write to InfluxDB failed (attempt: 1). Error:
at S.<anonymous> (/Users/sathish/Documents/sample/raviAPI/node_modules/core-js/internals/wrap-error-constructor-with-cause.js:37:62)
at new super (/Users/sathish/Documents/sample/raviAPI/node_modules/core-js/modules/es.error.cause.js:28:43)