https://bugs.kde.org/show_bug.cgi?id=447245

--- Comment #36 from Yosuke Matsumura <yosukematsum...@gmail.com> ---
I think the root cause lies in the recheckSystemUpdateNeeded() code
(https://github.com/KDE/discover/blob/3f21df4ba47c6f8f1a57e53e62c9bcfe4beeff4c/notifier/DiscoverNotifier.cpp#L346).
Here, the backend modules are checking for updates, but refreshUnattended()
gets called before the backends have time to trigger updateStatusNotifier() and
flip the hasUpdates and hasSecurityUpdates to "true". So refreshUnattended()
exits with "no updates to notify".

I added a 20-second delay to the refreshUnattended() call  in
recheckSystemUpdateNeeded(), and that seems to get it past that issue.

However, there's also a problem with notifyAboutUpdates() I think. `QDateTime
earliestNextNotificationTime` is taken from lastNotificationTime (which is
stored in UTC). However, earliestNextNotificationTime inherits the local time
zone (PDT for me). So if RequiredNotificationInterval is 60sec, for example the
current time is 5:00am PDT and a notification is popped, and the
lastNotificationTime is stored as `2025,4,7,12,00,0.000` - which is in UTC:
lastNotificationTime is 5:00 PDT / 12:00 UTC
earliestNextNotificationTime becomes 12:01PDT / 19:01 UTC
So the earliestNextNotificationTime is set to 7hrs 1min as the effective
notification interval, instead of the 60sec in the config.
Changing the logic to the following fixes this:
> QDateTime temp_earliestNextNotificationTime = 
> m_settings->lastNotificationTime().addSecs(m_settings->requiredNotificationInterval());
> temp_earliestNextNotificationTime.setTimeZone(QTimeZone("UTC"));

I had to play with setting a really low RequiredNotificationInterval (10s), as
otherwise the 20 second delay for refreshUnattended() would mean that
notifyAboutUpdates() would return false and not move refreshUnattended()
forward.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to