在使用 mikael 的请求模块时,我正在运行以下命令:
if(product.Links.Direct_Link)
{
var string = product.Links.Direct_Link;
console.log(string)
request({'uri': string, 'jar': true, 'followRedirects': false, 'maxSockets': 15, 'headers': { "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0"}}, getSizes);
} else {
callback(null, product);
}
这是这个的输出:
(node) warning: possible EventEmitter memory leak detected. 11 listeners added.
Use emitter.setMaxListeners() to increase limit.
http://www.spartoo.dk/Palladium_BARROW_KID-x30475.php?sx=G
Trace
at Socket.EventEmitter.addListener (events.js:160:15)
at Socket.Readable.on (_stream_readable.js:679:33)
at Socket.EventEmitter.once (events.js:179:8)
at Request.onResponse (C:\Vuuh\trunk\feedserver\node_modules\request\index.j
s:645:25)
at ClientRequest.g (events.js:175:14)
at ClientRequest.EventEmitter.emit (events.js:95:17)
at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1669:21)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:120:23
)
at Socket.socketOnData [as ondata] (http.js:1564:20)
at TCP.onread (net.js:525:27)
我为此请求提供了很多 http,因为我希望它解析数千个网页。
有趣的是,我在另一个网站上运行它并没有遇到这个问题(尽管该网站只有 1/10 的页面数量)?
有人知道为什么我会收到事件发射器警告吗?它使脚本随着时间的推移耗尽内存!