Hopefully fix rate limit errors for elevation service

pull/108/head
Candid Dauth 2017-05-24 00:29:25 +02:00
rodzic f146f6b4d2
commit ffc13e645c
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -11,10 +11,10 @@ const request = require("request-promise").defaults({
const API_URL = "https://elevation.mapzen.com/height"; const API_URL = "https://elevation.mapzen.com/height";
const API_KEY = "mapzen-LWPWRB1"; const API_KEY = "mapzen-LWPWRB1";
const LIMIT = 500; const LIMIT = 500;
const PER_SECOND_LIMIT = 2; const MIN_TIME_BETWEEN_REQUESTS = 600;
const throttle = highland(); const throttle = highland();
throttle.ratelimit(PER_SECOND_LIMIT, 1000).each((func) => { throttle.ratelimit(1, MIN_TIME_BETWEEN_REQUESTS).each((func) => {
func(); func();
}); });