Bug 498009 - When started with no network connectivity, Weather widget should update as soon as connectivity is restored, rather than waiting for the normal update interval
Summary: When started with no network connectivity, Weather widget should update as so...
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Weather widget (show other bugs)
Version: 6.2.4
Platform: Fedora RPMs Linux
: NOR wishlist
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-29 10:34 UTC by kderocks38
Modified: 2025-01-18 11:21 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.3.0
Sentry Crash Report:


Attachments
weather not updating on start (61.48 KB, image/png)
2024-12-29 10:34 UTC, kderocks38
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kderocks38 2024-12-29 10:34:56 UTC
Created attachment 176943 [details]
weather not updating on start

Hi,

On computer starts, sometimes the weather widget remains stuck with a "?" symbol for 30 minutes. 
However if I configure the widget's weather source the symbol disappears and the weather updates instantly.

My guess is that the times it takes to connect to wifi on start may impact the widget getting its data when it starts.
But having no refresh option and having a minimum refresh time of 30 minutes does not help this situation for this nice and very useful widget.

Thank you for your time,
Comment 1 Nate Graham 2025-01-04 00:40:07 UTC
What weather provider are you using for your weather widgets? I don't see this with mine that uses the NOAA provider. Would be interesting to see if it reproduces with all weather providers for you, or only some.
Comment 2 kderocks38 2025-01-04 09:44:24 UTC
Hi, 

Sorry I could have made this one clearer from the start actually  :) :

If I log in being online, the weather shows up instantly.
If I  log in without being online, the "?" shows up on the widget and takes 30 minutes to update.

Is it the same for you?

(to answer your question, BBC, being in Europe I don't see NOAA nor other provider)
Comment 3 Nate Graham 2025-01-06 23:22:41 UTC
Aha, that makes sense.
Comment 4 Ismael Asensio 2025-01-07 02:29:28 UTC
I've been running some tests to better pinpoint the issue.

The good news are that there is already code to automatically update the weather report when connectivity is restored, and that part seems to be working fine. In the backend, after a network reconnect, the api calls to fetch new data are being made for all the providers, as this is part of the common DataEngine.

What it is failing though, it is for this new data to be reflected in the applet in some cases, so it stays showing the "? Not found" until the next scheduled updated. On my tests, this is only failing for BBC and DWD providers, while others are updated appropriately. 

Since those two providers share some common code, I'm optimistic in finding the cause
Comment 5 Ismael Asensio 2025-01-07 20:53:27 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/5033
Comment 6 Ismael Asensio 2025-01-14 12:33:56 UTC
Git commit 0bfc8f4804d8d38cf9a29651088f79fe6123b7b1 by Ismael Asensio.
Committed on 14/01/2025 at 11:57.
Pushed by iasensio into branch 'master'.

dataengines/weather: Fix applet update on network reconnection

The weather dataengine has code to update the weather data when the
network state gets back online, by issuing a forced update via the
`reset()` method.

The ion provider stores which sources will be updated in the member:
`m_sourcesToReset = sources()`, to later emit a `forceUpdate()` signal
on those and refresh the applet.

Fix this mechanism for DWD and BBC providers, by ensuring the weather
`source` is always stored internally, which was wrongly removed in
recent refactors. Also move the relevant code to a better place and
comment appropriately so the purpose is more clear.
FIXED-IN: 6.3.0

M  +8    -5    dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp
M  +8    -11   dataengines/weather/ions/dwd/ion_dwd.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/0bfc8f4804d8d38cf9a29651088f79fe6123b7b1
Comment 7 kderocks38 2025-01-14 12:42:59 UTC
@isma(In reply to Ismael Asensio from comment #6)
Thanks a lot for your time and effort  Ismael !
Comment 8 Ismael Asensio 2025-01-14 14:15:36 UTC
Git commit dce47eea1cc86a78888a57bebf3c382b19c59a3c by Ismael Asensio.
Committed on 14/01/2025 at 12:34.
Pushed by iasensio into branch 'Plasma/6.3'.

dataengines/weather: Fix applet update on network reconnection

The weather dataengine has code to update the weather data when the
network state gets back online, by issuing a forced update via the
`reset()` method.

The ion provider stores which sources will be updated in the member:
`m_sourcesToReset = sources()`, to later emit a `forceUpdate()` signal
on those and refresh the applet.

Fix this mechanism for DWD and BBC providers, by ensuring the weather
`source` is always stored internally, which was wrongly removed in
recent refactors. Also move the relevant code to a better place and
comment appropriately so the purpose is more clear.
FIXED-IN: 6.3.0


(cherry picked from commit 0bfc8f4804d8d38cf9a29651088f79fe6123b7b1)

Co-authored-by: Ismael Asensio <isma.af@gmail.com>

M  +8    -5    dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp
M  +8    -11   dataengines/weather/ions/dwd/ion_dwd.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/dce47eea1cc86a78888a57bebf3c382b19c59a3c