How do I set a timeout for a mysql query in node.js?
/*...*/
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 */
});
}
I suggest you look up this link:
http://www.exratione.com/2013/01/nodejs-connections-will-end-close-and-otherwise-blow-up/
But the module doesn't seems to have any support for it at the moment.