【问题标题】:Node.js - mysql query timeoutNode.js - mysql 查询超时
【发布时间】:2013-01-19 03:52:12
【问题描述】:

如何在 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 */

     });
}

【问题讨论】:

    标签: mysql node.js


    【解决方案1】:

    我建议你查一下这个链接:

    http://www.exratione.com/2013/01/nodejs-connections-will-end-close-and-otherwise-blow-up/

    但该模块目前似乎没有任何支持。

    【讨论】:

    • 感谢您的回答。那么有什么替代方案呢?如果没有超时功能,模块似乎不适合生产.. 嗯。
    猜你喜欢
    • 2011-01-14
    • 1970-01-01
    • 2011-02-18
    • 1970-01-01
    • 1970-01-01
    • 2020-01-17
    • 2018-07-15
    • 2017-06-06
    • 1970-01-01
    相关资源
    最近更新 更多