Skip to content

makecache always refreshes repositories #2242

@evan-goode

Description

@evan-goode

The makecache command always refreshes repositories even if they are not expired, contrary to its documentation:

Downloads and caches metadata for enabled repositories. Tries to avoid downloading whenever possible (e.g. when the local metadata hasn’t expired yet or when the metadata timestamp hasn’t changed).

To reproduce, run sudo dnf4 makecache, then another sudo dnf4 makecache and observe in /var/log/dnf.log:

2025-05-22T20:39:36+0000 DEBUG fedora: has expired and will be refreshed.

sudo dnf4 rq --available hello for example does use the metadata cache.

More specifically, the problem is that Base.update_cache and/or Repo._metadata_expire_in do not query the cache correctly. At least within DNF, both functions are only used by makecache.

We probably shouldn't change this now as users may have come to expect the unintended behavior from makecache, but we should change makecache's documentation to be correct.

See also https://bugzilla.redhat.com/show_bug.cgi?id=2324177.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions