File 0001-Only-save-the-last-update-timestep-on-success.patch of Package plasma5-pk-updates

From d9708fb7efead687e38815183596eaf62fbdf3d7 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Mon, 25 Dec 2017 17:56:47 +0100
Subject: [PATCH 1/3] Only save the last update timestep on success

Summary:
If the check for updates failed, it'll trigger a new check on the next timer
interval (1h) now.

Test Plan:
Ran the check with YaST open in the background to cause the check
to fail. Now the timestamp does not refresh anymore.

Reviewers: lukas, jgrulich

Subscribers: plasma-devel

Differential Revision: https://phabricator.kde.org/D9503
---
 src/declarative/pkupdates.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/declarative/pkupdates.cpp b/src/declarative/pkupdates.cpp
index ce46df8..f04c173 100644
--- a/src/declarative/pkupdates.cpp
+++ b/src/declarative/pkupdates.cpp
@@ -198,11 +198,6 @@ void PkUpdates::checkUpdates(bool force)
 {
     qCDebug(PLASMA_PK_UPDATES) << "Checking updates, forced";
 
-    // save the timestamp
-    KConfigGroup grp(KSharedConfig::openConfig("plasma-pk-updates"), "General");
-    grp.writeEntry("Timestamp", QDateTime::currentDateTime().toMSecsSinceEpoch());
-    grp.sync();
-
     // ask the Packagekit daemon to refresh the cache
     m_cacheTrans = PackageKit::Daemon::refreshCache(force);
     setActivity(CheckingUpdates);
@@ -352,6 +347,12 @@ void PkUpdates::onFinished(PackageKit::Transaction::Exit status, uint runtime)
     if (trans->role() == PackageKit::Transaction::RoleRefreshCache) {
         if (status == PackageKit::Transaction::ExitSuccess) {
             qCDebug(PLASMA_PK_UPDATES) << "Cache transaction finished successfully";
+
+            // save the timestamp
+            KConfigGroup grp(KSharedConfig::openConfig("plasma-pk-updates"), "General");
+            grp.writeEntry("Timestamp", QDateTime::currentDateTime().toMSecsSinceEpoch());
+            grp.sync();
+
             return;
         } else {
             qCDebug(PLASMA_PK_UPDATES) << "Cache transaction didn't finish successfully";
-- 
2.15.0

openSUSE Build Service is sponsored by