如何在node.js中为mysql查询设置超时?
/*...*/
var mysql = require("mysql");
/* ...*/
app.get("/", function(req, res) {
connection.query("SELECT ...", function(err, rows, fields) {
/* I want this query to fail if the ^_ callback is not invoked within x seconds */
});
}
答案 0 :(得分:2)
我建议你查一下这个链接:
http://www.exratione.com/2013/01/nodejs-connections-will-end-close-and-otherwise-blow-up/
但该模块目前似乎没有任何支持。