From 60b4fc3351d0b57071bfd5fe9d55c71a5c56619f Mon Sep 17 00:00:00 2001 From: Ben Whittaker Date: Sun, 7 Jun 2020 15:37:31 -0400 Subject: [PATCH] weather: make expiry default to 2 hours --- apps/weather/lib.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/weather/lib.js b/apps/weather/lib.js index 8eda2dea9..fffc523ca 100644 --- a/apps/weather/lib.js +++ b/apps/weather/lib.js @@ -6,8 +6,9 @@ function scheduleExpiry(json) { clearTimeout(expiryTimeout); expiryTimeout = undefined; } - if (json.weather && json.weather.time && json.expiry) { - let t = json.weather.time + json.expiry - Date.now(); + let expiry = "expiry" in json ? json.expiry : 2*3600000; + if (json.weather && json.weather.time && expiry) { + let t = json.weather.time + expiry - Date.now(); expiryTimeout = setTimeout(() => { expiryTimeout = undefined;