使用pipe道节点请求阻止交换机api上的504网关超时

我使用以下代码进行OpenStreetMap查询(overpass-API)。 它在较小的查询上正常工作,但在较大的查询上工作正常,大约需要10分钟,它仅生成504网关超时响应。

码:

var reqStr = "http://overpass.osm.rambler.ru/cgi/interpreter?data=... console.time("query"); var stream = request(reqStr,{timeout: 3600000}).on('error', function(err) { console.log(err) }).pipe(fs.createWriteStream('resultExport.json')); stream.on('finish', function () { console.timeEnd("query"); }); 

响应(resultExport.json):

 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>504 Gateway Time-out</title> </head><body> <h1>Gateway Time-out</h1> <p>The gateway did not receive a timely response from the upstream server or application.</p> </body></html> 

查询命令有一个[timeout:3600] (秒),请求得到了{timeout:3600000} (毫秒)。 我还能做什么来防止超时并得到适当的响应? 这是从哪里来的,我有点困惑。

这是一个已知的问题,尚未在立交桥API服务器上得到解决/修复。

有关详细信息,请参阅此Github问题: https : //github.com/drolbr/Overpass-API/issues/220

Interesting Posts