weather: make expiry default to 2 hours

pull/492/head
Ben Whittaker 2020-06-07 15:37:31 -04:00
parent 2cb595300e
commit 60b4fc3351
1 changed files with 3 additions and 2 deletions

View File

@ -6,8 +6,9 @@ function scheduleExpiry(json) {
clearTimeout(expiryTimeout); clearTimeout(expiryTimeout);
expiryTimeout = undefined; expiryTimeout = undefined;
} }
if (json.weather && json.weather.time && json.expiry) { let expiry = "expiry" in json ? json.expiry : 2*3600000;
let t = json.weather.time + json.expiry - Date.now(); if (json.weather && json.weather.time && expiry) {
let t = json.weather.time + expiry - Date.now();
expiryTimeout = setTimeout(() => { expiryTimeout = setTimeout(() => {
expiryTimeout = undefined; expiryTimeout = undefined;