On Wed, Jul 22, 2015 at 5:22 PM, Suvayu Ali <fatkasuvayu+linux@gmail.com> wrote:
On Wed, Jul 22, 2015 at 07:20:11PM +0100, Ron Yorston wrote:
> Suvayu Ali wrote:
> >That said, I sometimes do not understand what's the harm in getting
> >updates few hours later.  dnf already tells you how old the metadata is
> >when it starts, you can choose to get the latest metadata if it is too
> >old.  So what's the big deal?
>
> I certainly get the impression that dnf tells me about updates less
> frequently than yum did.  It also seems to pull in metadata less
> frequently.

Everyone seems to picked on this post for me, whereas missing on my
follow-up, with actual numbers:

  <http://mid.gmane.org/20150722160112.GC1727@chitra.no-ip.org>

> In fedora-updates.repo I have:  metadata_expire=6h.  I also have the
> dnf-makecache.timer 'masked'.

In the above post, I say I do not change any of the defaults metadata
related configs.  From what people are posting, I have the feeling dnf
relies a lot on _continuous_ network connectivity (which is true in my
case).  If that is true, if either the connection at the users end is
intermittent, or the mirrors are unreliable, the cache probably ends up
being stale more often.

Instead of bashing and complaining, I think trying to analyse why it
works for me (and maybe a few others who are quiet), and not for the
other participants in this thread, it would be a lot more helpful to the
devs.  I can't help here since it actually works for me beautifully.
Users who see a problem are the ones in a position to contribute an
effective bug report.

My 2¢, cheers,

--
Suvayu

There is a timer unit, `/usr/lib/systemd/system/dnf-makecache.timer`, that fires ten minutes after each boot then one hour following the execution of each previous run.  It triggers `/usr/lib/systemd/system/dnf-makecache.service`, a service that executes `dnf -v makecache timer`.  When that command runs, dnf will check the age of the current metadata cache and refresh it if it is older than the value of * metadata_timer_sync* (seconds) in `/etc/dnf/dnf.conf`.

So, an always-on computer should never have metadata older than 4 hours; in practical terms, I think values >2 hours are increasingly unlikely.  A computer that's been off overnight and turned on in the morning should have a fresh cache within 15 minutes of boot.  If you have, say, a laptop that you power down often and often install or update packages immediately after boot, you might adjust the OnBootSec value by copying dnf-makecache.timer to /etc/systemd/system/ and editing accordingly.  Or, consider appending --refresh on an as-needed basis.

-- Pete