错误:使用带有async.forEach的请求模块读取ECONNRESET错误

时间:2014-08-03 16:52:50

标签: node.js

在async.forEach循环中使用Request模块时出现ECONNRESET错误。

我循环并抓取亚马逊页面,有时它会完成所有迭代,有时它不会因ECONNRESET错误而失败。

这是我的代码:

http://pastebin.com/zG6Yf4gZ

有没有人有任何想法如何解决这个问题?

这是我的错误日志的快照:

options maratona-uk-distribution
url http://www.ebay.co.uk/csc/maratona-uk-distribution/m.html?_ipg=100&_since=30
&_sop=13&rt=nc&LH_BIN=1&LH_FS=1&_fcid=3
results 2174
pages []
results 1
pages [ 0, 100 ]
aaaaaa a0
Scraping eBay URL: http://www.ebay.co.uk/csc/maratona-uk-distribution/m.html?_ip
g=100&_since=30&_sop=13&rt=nc&LH_BIN=1&LH_FS=1&_skc=0&_fcid=3
aaaaaa a100
Scraping eBay URL: http://www.ebay.co.uk/csc/maratona-uk-distribution/m.html?_ip
g=100&_since=30&_sop=13&rt=nc&LH_BIN=1&LH_FS=1&_skc=100&_fcid=3
iteration completed
iteration completed
All listings scraped successfully
Data returned successfully
list length 20
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
else
calling callback 2
here
POST /search 200 120006ms
error
Error { [Error: read ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET', syscal
l: 'read' }

0 个答案:

没有答案