File 0001-Limit-to-one-automatic-check-each-10-minutes.patch of Package plasma5-pk-updates
From 2e968cb632acdd1dbadcd0960fc44935c962847f Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Fri, 17 Apr 2020 16:06:25 +0200
Subject: [PATCH 1/2] Limit to one automatic check each 10 minutes
Otherwise each network or battery change results in a check, which
can be especially annoying if those fail for some reason (e.g. no internet).
---
src/plasma/contents/ui/main.qml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/plasma/contents/ui/main.qml b/src/plasma/contents/ui/main.qml
index aaec014..bb87f1b 100644
--- a/src/plasma/contents/ui/main.qml
+++ b/src/plasma/contents/ui/main.qml
@@ -40,6 +40,9 @@ Item
property bool checkOnMobile: plasmoid.configuration.check_on_mobile
property bool checkOnBattery: plasmoid.configuration.check_on_battery
+ property double lastCheckAttempt: PkUpdates.lastRefreshTimestamp()
+ readonly property int secsAutoCheckLimit: 10 * 60
+
readonly property int secsInDay: 60 * 60 * 24;
readonly property int secsInWeek: secsInDay * 7;
readonly property int secsInMonth: secsInDay * 30;
@@ -54,6 +57,7 @@ Item
interval: 1000 * 60 * 60; // 1 hour
onTriggered: {
if (needsForcedUpdate() && networkAllowed && batteryAllowed) {
+ lastCheckAttempt = Date.now();
PkUpdates.checkUpdates(true /* force */, false /* manual */);
}
}
@@ -75,6 +79,10 @@ Item
}
function needsForcedUpdate() {
+ if ((Date.now() - lastCheckAttempt)/1000 < secsAutoCheckLimit) {
+ return false;
+ }
+
var secs = (Date.now() - PkUpdates.lastRefreshTimestamp())/1000; // compare with the saved timestamp
if (secs < 0) { // never checked before
return true;
--
2.25.1