Skip to content

PackageKit: specify a cache-age otherwise it is infinite by default#23087

Draft
MatMaul wants to merge 1 commit intocockpit-project:mainfrom
MatMaul:pk-cache-age
Draft

PackageKit: specify a cache-age otherwise it is infinite by default#23087
MatMaul wants to merge 1 commit intocockpit-project:mainfrom
MatMaul:pk-cache-age

Conversation

@MatMaul
Copy link
Copy Markdown

@MatMaul MatMaul commented Apr 2, 2026

Completely untested because I don't have a dev env to test but something like that should be enough to fix #23086 I believe.

debug("constructing packagekit");
package_manager = new PackageKitManager();
let pk_manager = new PackageKitManager();
await pk_manager.init();
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may want to add an init method directly on the PackageManager interface instead of doing what I did here. We can't do that in the constructor since we need an async context.

@Venefilyn
Copy link
Copy Markdown
Member

Not sure if this will work as SetHints seem to be for a created transaction. Maybe we can do something like this, will check

diff --git a/pkg/lib/packagekit.js b/pkg/lib/packagekit.js
index 6b2061124..8821a7a1f 100644
--- a/pkg/lib/packagekit.js
+++ b/pkg/lib/packagekit.js
@@ -186,6 +186,9 @@ export function transaction(method, arglist, signalHandlers, notifyHandler) {
 
                 const watchPromise = watchTransaction(transactionPath, signalHandlers, notifyHandler) || Promise.resolve();
                 return watchPromise.then(() => {
+                    // FIX: force set cache to 24h as some PK backends like dnf4 doesn't
+                    // integrate with PK cache and shows cache as 0.
+                    call(transactionPath, transactionInterface, "SetHints", ["cache-age=86400"]);
                     if (method) {
                         return call(transactionPath, transactionInterface, method, arglist)
                                 .then(() => transactionPath);

@MatMaul
Copy link
Copy Markdown
Author

MatMaul commented Apr 8, 2026

Indeed good catch thanks.

I've build some rpm for my server and I'll be able to test it on next available updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Daily cache force-refresh on PackageKit can never trigger

2 participants