使用管道节点请求防止立交桥 api 上的 504 网关超时

Prevent 504 gateway timeout on overpass api with piped node request

我使用以下代码进行 OpenStreetMap 查询(立交桥-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}(毫秒) .我还能做些什么来防止超时并获得正确的响应?我有点困惑这是从哪里来的。

这是一个已知问题,尚未在 Overpass API 服务器上 addressed/fixed。

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