Red Hat Bugzilla – Bug 1048988
[plugins] [api] add a hook for MD refresh
Last modified: 2014-09-30 19:42:00 EDT
For the bash completion plugin, I'd need a hook that will be called every time makecache completes.
Also, if someone runs dnf makecache --cacheonly, dnf should not download anything but run the hook anyway. This will allow the completion plugin to generate the cache it needs if the completion cache does not exist but dnf does have downloaded repository information stored.
Elad, I thought the hook would be for any time the MD refresh happens, no? Some people never run makecache FWIW. I might have confused you about disliking the time penalty: I don't mind adding a few ms to every run where new metadata is downloaded, I just don't like adding a few ms to *every run*.
> I just don't like adding a few ms to *every run*.
neither do I.
> I thought the hook would be for any time the MD refresh happens, no?
You said that's hard. I suggested makecache as a compromise. The timer also runs makecache, so if we assume most people will not turn it off those few ms will be added to a background process, which means users won't notice the slowness, and it'd be also easier for you to implement.
Anyway, I'm okay with having that hook on MD refresh OR every time makecache is run. Either is fine for my use.
I just looked at your plugin in detail, you do:
available_packages = self.base.sack.query().available()
Which means you'll still have to wait for the sack() trigger to fire because you need the sack to be ready. So I guess what we really need is a way to determine if any MD has been updated during while the sack was built, rather then the hook. Admittedly a combination of the two can yield the same results but I think being able to tell where we got the MD from (cache vs. origin) is useful for more API clients then the refresh hook.
Makes sense, but need to make sure this value will be set to "origin" even if just one repo was updated.
this value is now set per-repo (repo.metadata.fresh), see 7e793fc.
So I should loop on every enabled repo, and if repo.metadata.fresh is set, regen the cache?
dnf-0.4.11-1.fc20 has been submitted as an update for Fedora 20.
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-0.4.11-1.fc20'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
dnf-0.4.11-1.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.