diff --git a/html/planeObject.js b/html/planeObject.js index 239baec..a2919f7 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -3036,7 +3036,7 @@ function routeDoLookup(currentTime) { }) .fail((jqxhr, status, error) => { g.route_check_in_flight = false; - g.route_cache_timer = Date.now()/1000 + 15; + g.route_next_lookup = Date.now()/1000 + 15; console.log('route API request error, delaying next request by 15 seconds.'); }); } diff --git a/html/script.js b/html/script.js index c672337..5c1e0ce 100644 --- a/html/script.js +++ b/html/script.js @@ -10,7 +10,7 @@ g.planesOrdered = []; g.route_cache = []; g.route_check_todo = {}; g.route_check_in_flight = false; -g.route_cache_timer = new Date().getTime() / 1000 + 1; // one second from now +g.route_next_lookup = 0; g.mapOrientation = mapOrientation; @@ -5741,9 +5741,9 @@ function checkMovement() { } let currentTime = new Date().getTime()/1000; - if (currentTime > g.route_cache_timer && !g.route_check_in_flight) { + if (currentTime > g.route_next_lookup && !g.route_check_in_flight) { // check if it's time to send a batch of request to the API server - g.route_cache_timer = currentTime + 1; + g.route_next_lookup = currentTime + 1; routeDoLookup(currentTime); }