router.route('...')
.get(function(req, res, next) {
// This job() function doing some *long* async task and end of the task calling 3th param as callback
job(param1, param2, function(response) {
// printing response to console perfectly
console.log("callback fired", response);
res.send("response");
});
});
而我正在以curl
来提出我的要求。在ExpressJS上尽早结束的请求
$ curl ... -m 300
curl: (52) Empty reply from server
卷曲等待了几分钟的回应,然后我得到空回复错误。 cURL在 nodejs打印回调触发消息之前给出此错误。
如果我用浏览器或邮递员发出此请求,则会出现同样的错误。
我敢肯定,res.end()
函数里面没有job()
异步函数。我卡住了,我如何跟踪并发现错误?
你猜我的问题是http服务器的默认超时设置。所以我把这个值从2分钟增加到5分钟,我的问题就解决了。谢谢。 – Eray