在使用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的页面数量)?
任何人都有一个指针,说明为什么我会收到一个警告?随着时间的推移,它会使脚本内存不足!