diff options
author | Aurélien LAJOIE <orel@melix.net> | 2020-02-07 21:07:59 +0100 |
---|---|---|
committer | Aurélien LAJOIE <orel@melix.net> | 2020-02-07 21:11:29 +0100 |
commit | efc2131442921921a4e10b6c756b271d4ade84d8 (patch) | |
tree | e9730cab5325fb1d7b083d9754934c55a100dd88 /weather-widget | |
parent | 8839e853df93c50ed5ff7c034915cd32a1c3e12a (diff) |
[weather] Add delay between retry
Having an error message every minute is painful, double time to 15 min.
Reset to 1min in case of success.
Diffstat (limited to 'weather-widget')
-rw-r--r-- | weather-widget/weather.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua index a1075f6..6fafa97 100644 --- a/weather-widget/weather.lua +++ b/weather-widget/weather.lua @@ -144,6 +144,8 @@ local function worker(args) end local function error_display(resp_json) + weather_timer.timeout = math.min(15 * 60, weather_timer.timeout * 2) + weather_timer:again() local err_resp = json.decode(resp_json) naughty.notify{ title = 'Weather Widget Error', @@ -185,6 +187,8 @@ local function worker(args) resp = json.decode(resp_json) icon_widget.image = path_to_icons .. icon_map[resp.weather[1].icon] temp_widget:set_text(gen_temperature_str(resp.main.temp, '%.0f', both_units_widget)) + weather_timer.timeout = 60 + weather_timer:again() end end) weather_timer:start() |