Projects
Eulaceura:Factory
plasma-discover
_service:obs_scm:discover-pk-cache-age.patch
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:discover-pk-cache-age.patch of Package plasma-discover
From 25f1c161d2616ba77a72babd923832ea9550cb9d Mon Sep 17 00:00:00 2001 From: Alessandro Astone <ales.astone@gmail.com> Date: Thu, 28 Sep 2023 15:59:43 +0200 Subject: [PATCH] pk: Set cache-age hint in the RefreshCache transaction The dnf backend implements the cache-age hint. For RefreshCache to do anything, we need to change the cache-age from the default - MAX_UINT32 - to a low amount. Here we set the cache-age to 5 minutes meaning that the backend will redownload the caches if they are more than 5 minutes old. --- libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp | 2 ++ libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp b/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp index 11d076702..521674a90 100644 --- a/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp +++ b/libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp @@ -534,6 +534,8 @@ void PackageKitBackend::checkForUpdates() acquireFetching(true); m_updater->clearDistroUpgrade(); m_refresher = PackageKit::Daemon::refreshCache(false); + // Limit the cache-age so that we actually download new caches if necessary + m_refresher->setHints(globalHints() << QStringLiteral("cache-age=300" /* 5 minutes */)); connect(m_refresher.data(), &PackageKit::Transaction::errorCode, this, &PackageKitBackend::transactionError); connect(m_refresher.data(), &PackageKit::Transaction::finished, this, [this]() { diff --git a/libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp b/libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp index ae5a58c51..64228e7f3 100644 --- a/libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp +++ b/libdiscover/backends/PackageKitBackend/PackageKitNotifier.cpp @@ -292,6 +292,8 @@ void PackageKitNotifier::refreshDatabase() if (!m_refresher) { m_refresher = PackageKit::Daemon::refreshCache(false); + // Limit the cache-age so that we actually download new caches if necessary + m_refresher->setHints(QStringLiteral("cache-age=300" /* 5 minutes */)); connect(m_refresher.data(), &PackageKit::Transaction::finished, this, &PackageKitNotifier::recheckSystemUpdateNeeded); } -- GitLab
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2